texlive[53782] Master/texmf-dist: subfiles (14feb20)

commits+karl at tug.org commits+karl at tug.org
Fri Feb 14 23:34:36 CET 2020


Revision: 53782
          http://tug.org/svn/texlive?view=revision&revision=53782
Author:   karl
Date:     2020-02-14 23:34:36 +0100 (Fri, 14 Feb 2020)
Log Message:
-----------
subfiles (14feb20)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/subfiles/README
    trunk/Master/texmf-dist/doc/latex/subfiles/subfiles.pdf
    trunk/Master/texmf-dist/source/latex/subfiles/subfiles.dtx
    trunk/Master/texmf-dist/tex/latex/subfiles/subfiles.cls
    trunk/Master/texmf-dist/tex/latex/subfiles/subfiles.sty

Modified: trunk/Master/texmf-dist/doc/latex/subfiles/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/subfiles/README	2020-02-14 22:34:22 UTC (rev 53781)
+++ trunk/Master/texmf-dist/doc/latex/subfiles/README	2020-02-14 22:34:36 UTC (rev 53782)
@@ -12,4 +12,4 @@
 and put them somewhere on the search path of TeX.
 
 Documentation:
-Run 'pdflatex subfiles.dtx' to generate subfiles.pdf.
+Run 'pdflatex subfiles.dtx' twice to generate subfiles.pdf.

Modified: trunk/Master/texmf-dist/doc/latex/subfiles/subfiles.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/subfiles/subfiles.dtx
===================================================================
--- trunk/Master/texmf-dist/source/latex/subfiles/subfiles.dtx	2020-02-14 22:34:22 UTC (rev 53781)
+++ trunk/Master/texmf-dist/source/latex/subfiles/subfiles.dtx	2020-02-14 22:34:36 UTC (rev 53782)
@@ -2,7 +2,7 @@
 %
 % subfiles - class and package for multi-file projects in LaTeX
 % Copyright 2002, 2012 Federico Garcia (feg8 at pitt.edu, fedegarcia at hotmail.com)
-% Copyright 2018, 2019 Gernot Salzer (salzer at logic.at)
+% Copyright 2018-2020 Gernot Salzer (salzer at logic.at)
 %
 % This work may be distributed and/or modified under the
 % conditions of the LaTeX Project Public License, either version 1.3
@@ -17,20 +17,20 @@
 % The Current Maintainer of this work is Gernot Salzer.
 %
 % This work consists of the files subfiles.dtx and subfiles.ins
-% and the derived files subfiles.sty and subfiles.pdf
+% and the derived files subfiles.cls, subfiles.sty and subfiles.pdf
 %
 % -------------------------------------------
 %
 %<*driver>
 % \fi
-\ProvidesFile{subfiles.dtx}[2019/10/30 v1.5 Multi-file projects]
+\ProvidesFile{subfiles.dtx}[2020/02/14 v1.6 Multi-file projects]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{subfiles.dtx}
 \title{A Document Class and a Package\\for Handling Multi-File Projects}
-\date{v1.5 2019/10/30}
+\date{2020/02/14 v1.6}
 \author{Federico Garcia, Gernot Salzer}
-
+\usepackage{hyperref}
 \begin{document}
 \maketitle
  \DocInput{\filename}
@@ -41,6 +41,7 @@
 %   The |subfiles| package allows authors to split a document into one main file and one and more subsidiary files (subfiles) akin to the |\input| command, with the added benefit of making the subfiles compilable by themselves.
 %   This is achieved by reusing the preamble of the main file also for the subfiles.
 % \end{abstract}
+% \tableofcontents
 % \section{Introduction}
 % The \LaTeX\ commands |\include| and |\input| allow the user to split the \TeX\ source of a document into several input files.
 % This is useful when creating documents with many chapters, but also for handling large tables, figures, and code samples, which require a considerable amount of trial-and-errors.
@@ -61,6 +62,7 @@
 % 
 % \section{Basic usage}
 %
+% \DescribeMacro{subfiles.sty}
 % The main file, i.e., the file with the preamble to be shared with the subfiles, has to load the package |subfiles| \emph{at the end of the preamble}:
 % \begin{center}
 %   \begin{tabular}{l}
@@ -68,10 +70,12 @@
 %     |\begin{document}|
 %   \end{tabular}
 % \end{center}
+% \DescribeMacro{\subfile}
 % Subordinate files (subfiles) are loaded from the main file or from other subfiles with the command
 % \begin{center}
 %   |\subfile{|\meta{subfile\_name}|}|
 % \end{center}
+% \DescribeMacro{subfiles.cls}
 % The subfiles have to start with the line
 % \begin{center}
 %   |\documentclass[|\meta{main\_file\_name}|]{subfiles}|
@@ -174,6 +178,7 @@
 %
 % \subsection{Including files instead of inputting them}
 %
+% \DescribeMacro{\subfileinclude}
 % In plain \LaTeX, you can use either |\input| or |\include| to load a file.
 % In most cases the first is appropriate, but sometimes there are reasons to prefer the latter.
 % Internally, the |\subfile| command uses |\input|.
@@ -185,30 +190,50 @@
 % \subsection{Bibliographies}
 %
 % Manual bibliographies with the |thebibliography| environment work as usual.
-% Problems may arise if external programs like |bibtex| or |biber| are used to generate the bibliography, in particular when the bibliographies are distributed over subfiles.
-% Here are some hints on how it may work.
+% Problems may arise if external programs like |bibtex| or |biber| are used to generate the bibliography.
+% Here are some hints on how to make it work.
 % \begin{itemize}
-% \item Make sure the command |\bibliography| is executed after loading the |subfiles| package.
+% \item
+%   \DescribeMacro{\bibliography}
+%   Make sure the command |\bibliography| is executed after loading the |subfiles| package.
 %   Put the command between |\usepackage{subfiles}| and |\begin{document}| or somewhere into the text part.
-% \item When you use the package |biblatex|, and programs like |biber| complain about not being able to find the bibliography files, use |\bibliography| instead of |\addbibresource| for local files (observing the hint above).
+% \item When you use the package |biblatex|, and programs like |biber| complain about not being able to find the bibliography files, use |\bibliography| instead of |\addbibresource| (see above), or the command |\subfix| (see below).
+% \item
+%  \DescribeMacro{\subfix}
+%  Whenever an external program complains that a file specified in the \LaTeX\ document cannot be found, wrap the command |\subfix| around the filename.
+%   Here are some examples.
+%   \begin{center}
+%     \begin{tabular}{ll}
+%         package & command when used with |subfiles| \\
+%         \hline
+%         |biblatex| & |\addbibresource{\subfix{|\meta{file}|}}| \\
+%         |bibunits| & |\putbib[\subfix{|\meta{file1}|},\subfix{|\meta{file2}|},|\dots|]|\\
+%                    & |\defaultbibliography{\subfix{|\meta{file1}|},|\dots|}|
+%       \end{tabular}
+%   \end{center}
+%   
 % \end{itemize}
-% The |subfiles| package has been tested with the packages |biblatex|, |bibunits|, and |chapterbib| as well as the external programs |bibtex| and |biber|. 
+% The |subfiles| package has been tested with the packages |biblatex|, |bibunits|, and |chapterbib| as well as with the external programs |bibtex| and |biber|. 
 % 
 % \subsection{Unusual locations for placing definitions and text}
 %
 % Usually all definitions and packages required by the subfiles should go into the preamble of the main file.
 % There are some further locations, though, where one might consider adding definitions and text.
+% Put negatively, apparently irrelevant stuff in these locations may become unexpectedly visible in the document or cause errors.
 %
 % \paragraph{Code after the end of the main document} is added to the preamble of the subfiles, but is ignored when typesetting the main file.
 % This happens because a subfile typeset by itself does not really take the preamble of the main file, but \emph{everything outside} of |\begin{document}| and |\end{document}|.
-% This has two consequences: \emph{a)}~the user can add some commands to be processed as part of the preamble only when the subfiles are typeset by themselves; but also \emph{b)}~the user has to be careful even \emph{after} |\end{document}| in the main file, for any syntax error there will ruin the \LaTeX ing of the subfile(s).
+% This has two consequences: \emph{a)}~the user can add some commands that are to be processed as part of the preamble only when the subfiles are typeset by themselves; but also \emph{b)}~the user has to be careful even \emph{after} |\end{document}| in the main file, for any syntax error there will ruin the \LaTeX ing of the subfile(s).
+% \bigskip
 %
+% Similarly, when typesetting the main document, the |\subfile| command does not really load the stuff within the |document| environment, but \emph{everything except} the three commands |\documentclass[...]{...}|, |\begin{document}|, and |\end{document}|.
+% This has the following consequences.
+%
 % \paragraph{Code in the preamble of a subfile} is processed as part of the text when typesetting the main file, but as part of the preamble when typesetting the subfile.
 % This means that the preamble of a subfile can only contain stuff that is acceptable for both, the preamble and the text area.
 % One should also keep in mind that each subfile is input within a group, so definitions made within may not work outside.
-% A good practice when using |subfiles| (and also when not using it) is to make any definitions in the preamble of the main file, avoiding confusion and allowing the reader to find them easily.
 %
-% \paragraph{Code after the end of a subfile} is treated like the code preceding it when the subfile is loaded from the main file, but is ignored when typesetting the subfile.
+% \paragraph{Code after \texttt{\textbackslash end\{document\}} in a subfile} is treated like the code preceding it when the subfile is loaded from the main file, but is ignored when typesetting the subfile.
 % The code after |\end{document}| behaves as if following the |\subfile| command in the main file, except that it is still part of the group enclosing the subfile.
 % As a consequence, empty lines at the end of the subfile lead to a new paragraph in the main document, even if the |\subfile| command is immediately followed by text.
 %
@@ -247,6 +272,26 @@
 %   |contents of subfile\end{document}|
 % \end{center}
 %
+% \section{Troubleshooting}
+%
+% Here are some hints that solve most problems.
+%
+% \begin{enumerate}
+% \item
+%   Make sure to use the most recent version of the |subfiles| package, available from CTAN\footnote{\url{https://ctan.org/pkg/subfiles}} and Github\footnote{\url{https://github.com/gsalzer/subfiles}}.
+% \item
+%   Make sure that |\usepackage{subfiles}| comes last in the preamble
+%   of the main document.
+% \item
+%   If some external program that cooperates with \TeX, like |bibtex| or |biber|, complains about not being able to find a file, locate the name of the file in the \LaTeX\ source and replace \meta{filename} by |\subfix{|\meta{filename}|}|.
+% \item
+%   Make sure that there is no stuff after |\end{document}|, neither in the main file nor in the subfiles.
+% \item
+%   If there is anything in the preambles of the subfiles, make sure that it is admissible for both, the preamble and the document area.
+% \item
+%   If nothing of the above helps and you are stuck, ask the people on tex.stackexchange\footnote{\url{https://tex.stackexchange.com/}}.
+% \end{enumerate}
+% 
 % \section{Dependencies}
 %
 % The |subfiles| package requires the |verbatim| package, whose |comment| environment is used to ignore the text area of the main file when typesetting subfiles separately.
@@ -266,7 +311,7 @@
 %   \begin{itemize}
 %   \item Use of |import| package to handle directory hierarchies.
 %   \item |\ignorespaces| added to avoid spurious spaces.
-%   \item Incompatibility with commands removed that expect |\document| to be equal to |\@onlypreamble| after the preamble (thanks to Eric Domenjoud for analysing the problem).
+%   \item Incompatibility with commands removed that expect |\document| to be equal to |\@onlypreamble| after the preamble. Thanks to Eric Domenjoud for analysing the problem.
 %   \end{itemize}
 % \item[v1.4:] \mbox{}
 %   \begin{itemize}
@@ -280,6 +325,13 @@
 %      Seems to suffice also for sub-bibliographies with the package |chapterbib|.
 %   \item Support for sub-bibliographies with package |bibunits| added.
 %   \end{itemize}
+% \item[v1.6:] \mbox{}
+%   \begin{itemize}
+%   \item Support for sub-bibliographies with package |bibunits| dropped, in favor of |\subfix|.
+%   \item Command |\subfix| added.
+%   \item Incompatibility with |standalone| class removed.
+%   \item The options of the main class are now also processed when typesetting a subfile; before they were ignored. Thanks to J\'an Kl'uka for analysing the problem.
+%   \end{itemize}
 % \end{description}
 %
 %\section{The Implementation}
@@ -287,13 +339,17 @@
 %    \begin{macrocode}
 %<*class>
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{subfiles}[2019/10/30 v1.5 Multi-file projects (class)]
+\ProvidesClass{subfiles}[2020/02/14 v1.6 Multi-file projects (class)]
 \DeclareOption*{\typeout{Preamble taken from file `\CurrentOption'}%
     \let\preamble at file\CurrentOption}
 \ProcessOptions
 %    \end{macrocode}
+% After processing the option of the |subfiles| class, we reset |\@classoptionslist| such that the options in the main file will be processed.
 %
-% We start by saving the regular \LaTeX\ definition of |\documentclass|:
+%    \begin{macrocode}
+\let\@classoptionslist\relax
+%    \end{macrocode}
+% Then we save the original definition of |\documentclass| to be able to reset it later to this definition:
 % 
 %    \begin{macrocode}
 \let\subfiles at documentclass\documentclass
@@ -326,42 +382,34 @@
 \RequirePackage{import}
 %    \end{macrocode}
 %
-% The |\subimport| command requires the path and the basename of the file to be loaded in separate arguments.
-% Therefore we have to split file names into these two components.
+% The |\subimport| command requires path and filename as separate arguments, so we have to split file locations into these two components.
+% The internal \LaTeX\ command |\filename at parse| almost fits the bill, except that it additionally splits the filename into basename and extension.
+% Unfortunately, concatenating basename and extension to recover the filename is not clean:
+% Under Unix/Linux, the filenames |base| and |base.| denote different entities, but after |\filename at parse| both have the same basename and an empty extension.
+% Therefore we redefine the command |\filename at simple| temporarily; it is responsible for this unwanted split.
 % 
 %    \begin{macrocode}
 \def\subfiles at split#1{%
-  \edef\subfiles at filename{#1}%
-  \def\subfiles at dir{}%
-  \def\subfiles at base{}%
-  \def\subfiles at sep{}%
-  \expandafter\subfiles at split@\subfiles at filename/\@nil/%
+  \let\subfiles at filename@simple\filename at simple
+  \def\filename at simple##1.\\{\edef\filename at base{##1}}%
+  \filename at parse{#1}%
+  \let\filename at simple\subfiles at filename@simple
 }
-\def\subfiles at split@#1/{%
-  \def\tmp{#1}%
-  \ifx\tmp\@nnil
-    \let\subfiles at next\relax
-  \else
-    \edef\subfiles at dir{\subfiles at dir\subfiles at base\subfiles at sep}%
-    \def\subfiles at base{#1}%
-    \def\subfiles at sep{/}%
-    \let\subfiles at next\subfiles at split@
-  \fi
-  \subfiles at next  
-}
 %    \end{macrocode}
 %
-% After executing e.g.\ |\subfiles at split{../dir1/dir2/file.tex}|, the commands |\subfiles at dir| and |\subfiles at base| expand to |../dir1/dir2/| and |file.tex|, respectively.
+% E.g., after executing |\subfiles at split{../dir1/dir2/file.tex}| the macros |\filename at area| and |\filename at base| expand to |../dir1/dir2/| and |file.tex|, respectively.
 %
 % Now we split the name of the main file that has been provided as optional argument of the document class, and |\subimport| the main file.
 %
 %    \begin{macrocode}
 \subfiles at split{\preamble at file}
-\subimport{\subfiles at dir}{\subfiles at base}
+\subimport{\filename at area}{\filename at base}
 %    \end{macrocode}
 %
 % The main file loads the package |subfiles| as part of the preamble, which saves the contents of |\document| and |\enddocument| as |\subfiles at document| and |\subfiles at enddocument|, respectively.
-% Then we restore the original values of |\document|, |\enddocument|, and |\documentclass|. The backup commands are |\undefined| to save memory. That's it.
+% We use these macors now to restore the original values of |\document|, |\enddocument|, and |\documentclass|.
+% The backup commands are |\undefined| to save memory.
+% That's it.
 %
 %    \begin{macrocode}
 {\catcode`\@=11
@@ -387,7 +435,7 @@
 %    \begin{macrocode}
 %<*package>
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{subfiles}[2019/10/30 v1.5 Multi-file projects (package)]
+\ProvidesPackage{subfiles}[2020/02/14 v1.6 Multi-file projects (package)]
 \DeclareOption*{\PackageWarning{\CurrentOption ignored}}
 \ProcessOptions
 %    \end{macrocode}
@@ -410,36 +458,26 @@
 % This happens e.g.\ with the class |revtex4| and the package |pythontex|.
 %
 % We use the |import| package to handle subfiles in separate directories.
-% The |\subimport| command requires the path and the basename of files as separate arguments.
-% Therefore we split file names into these two components using a macro |\subfiles at split|.
-% Both things, loading the package and defining the command, is also done in |subfiles.cls|, so we have to execute this code only if we are typesetting the main file.
+% The |\subimport| command requires path and filename as separate arguments, so we have to split file locations into these two components.
+% The internal \LaTeX\ command |\filename at parse| almost fits the bill, except that it additionally splits the filename into basename and extension.
+% Unfortunately, concatenating basename and extension to recover the filename is not clean:
+% Under Unix/Linux, the filenames |base| and |base.| denote different entities, but after |\filename at parse| both have the same basename and an empty extension.
+% Therefore we redefine the command |\filename at simple| temporarily; it is responsible for this unwanted split.
+% Both things, loading the package and defining the command, are also done in |subfiles.cls|, so we have to execute this code only if we are typesetting the main file.
 % 
 %    \begin{macrocode}
-}{% subfiles class not loaded
+}{% subfiles class not loaded, we typeset the main document
   \RequirePackage{import}
   \def\subfiles at split#1{%
-    \edef\subfiles at filename{#1}%
-    \def\subfiles at dir{}%
-    \def\subfiles at base{}%
-    \def\subfiles at sep{}%
-    \expandafter\subfiles at split@\subfiles at filename/\@nil/%
-  }%
-  \def\subfiles at split@#1/{%
-    \def\tmp{#1}%
-    \ifx\tmp\@nnil
-      \let\subfiles at next\relax
-    \else
-      \edef\subfiles at dir{\subfiles at dir\subfiles at base\subfiles at sep}%
-      \def\subfiles at base{#1}%
-      \def\subfiles at sep{/}%
-      \let\subfiles at next\subfiles at split@
-    \fi
-    \subfiles at next
-  }%
+    \let\subfiles at filename@simple\filename at simple
+    \def\filename at simple##1.\\{\edef\filename at base{##1}}%
+    \filename at parse{#1}%
+    \let\filename at simple\subfiles at filename@simple
+  }
 }
 %    \end{macrocode}
 %
-% After executing e.g.\ |\subfiles at split{../dir1/dir2/file.tex}|, the commands |\subfiles at dir| and |\subfiles at base| expand to |../dir1/dir2/| and |file.tex|, respectively.
+% E.g., after executing |\subfiles at split{../dir1/dir2/file.tex}| the macros |\filename at area| and |\filename at base| expand to |../dir1/dir2/| and |file.tex|, respectively.
 %
 % \DescribeMacro{\subfile}
 % The command |\subfile| specifies the command |\subimport| for |\input|ing the subfile, and then calls |\subfiles at subfile|.
@@ -460,17 +498,24 @@
 %    \end{macrocode}
 %
 % The main functionality of the two |\subfile| commands is implemented in |\subfiles at subfile|.
-% It redefines |\documentclass| and the |document| environment to do nothing except avoiding spurious spaces.
-% Moreover, |\document| has to be set to the value it usually has after the end of the preamble, since some commands check this value and may raise an error otherwise.
+% It redefines |\documentclass| and the |document| environment to do nothing but reverting these command to their original meaning and avoiding spurious spaces.
+% Reverting |\documentclass| and |\document| to their original definition is important for being compatible with classes like |standalone| or packages like |bibentry|, which rely on this definition.
 %
 %    \begin{macrocode}
 \newcommand\subfiles at subfile[1]{%
   \begingroup
-  \renewcommand\documentclass[2][subfiles]{\ignorespaces}%
+  \let\subfiles at documentclass\documentclass
+  \let\subfiles at document\document
+  \let\subfiles at enddocument\enddocument
+  \renewcommand\documentclass[2][subfiles]{%
+    \let\documentclass\subfiles at documentclass
+    \ignorespaces
+  }%
   \renewenvironment{document}{%
-    \let\document\@onlypreamble
+    \let\document\subfiles at document
     \ignorespaces
   }{%
+    \let\enddocument\subfiles at enddocument
     \@ignoretrue
   }%
 %    \end{macrocode}
@@ -478,13 +523,11 @@
 %
 %    \begin{macrocode}
   \subfiles at split{#1}%
-  \subfiles at loadfile{\subfiles at dir}{\subfiles at base}%
+  \subfiles at loadfile{\filename at area}{\filename at base}%
   \endgroup
 }
 %    \end{macrocode}
 %
-% Note that the changes to |\documentclass| and the |document| environment happen \emph{within a group}, so they are undone after inclusion of the subfile.
-%
 % To let external programs find files, we have to add the |\import at path| to file names.
 % This is accomplished with the command |\subfiles at addimportpath|.
 %    \begin{macrocode}
@@ -492,12 +535,18 @@
   \def\subfiles at filelist{}%
   \def\subfiles at sep{}%
   \@for\subfiles at filename:=#1\do{%
-    \edef\subfiles at filelist{\subfiles at filelist\subfiles at sep\import at path\subfiles at filename}%
+    \edef\subfiles at filelist{%
+      \subfiles at filelist
+      \subfiles at sep
+      \import at path
+      \subfiles at filename
+    }%
     \def\subfiles at sep{,}%
   }
 }
 %    \end{macrocode}
 %
+% \DescribeMacro{\bibliography}
 % We redefine the |\bibliography| command such that the import path is added to the file names before the original command is called.
 %    \begin{macrocode}
 \let\subfiles at bibliography\bibliography
@@ -507,13 +556,8 @@
 }
 %    \end{macrocode}
 %
-% The |bibunits| package uses its own command to specify bib files, we have to patch it separately.
+% \DescribeMacro{\subfix}
+% Instead of adding further fixes for other packages that write filenames to external files (like |bibunits|), we provide a command for adding the |\import at path| to a filename.
 %    \begin{macrocode}
-\@ifpackageloaded{bibunits}{%
-  \let\subfiles at putbib\@putbib
-  \def\@putbib[#1]{%
-    \subfiles at addimportpath{#1}%
-    \expandafter\subfiles at putbib\expandafter[\subfiles at filelist]%
-  }%
-}{}
+\def\subfix#1{\import at path#1}
 %    \end{macrocode}

Modified: trunk/Master/texmf-dist/tex/latex/subfiles/subfiles.cls
===================================================================
--- trunk/Master/texmf-dist/tex/latex/subfiles/subfiles.cls	2020-02-14 22:34:22 UTC (rev 53781)
+++ trunk/Master/texmf-dist/tex/latex/subfiles/subfiles.cls	2020-02-14 22:34:36 UTC (rev 53782)
@@ -26,10 +26,11 @@
 %% and the derived files subfiles.sty and subfiles.pdf
 %% 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{subfiles}[2019/10/30 v1.5 Multi-file projects (class)]
+\ProvidesClass{subfiles}[2020/02/14 v1.6 Multi-file projects (class)]
 \DeclareOption*{\typeout{Preamble taken from file `\CurrentOption'}%
     \let\preamble at file\CurrentOption}
 \ProcessOptions
+\let\@classoptionslist\relax
 \let\subfiles at documentclass\documentclass
 \let\documentclass\LoadClass\relax
 \RequirePackage{verbatim}
@@ -37,26 +38,13 @@
 \let\subfiles at endcomment\endcomment
 \RequirePackage{import}
 \def\subfiles at split#1{%
-  \edef\subfiles at filename{#1}%
-  \def\subfiles at dir{}%
-  \def\subfiles at base{}%
-  \def\subfiles at sep{}%
-  \expandafter\subfiles at split@\subfiles at filename/\@nil/%
+  \let\subfiles at filename@simple\filename at simple
+  \def\filename at simple##1.\\{\edef\filename at base{##1}}%
+  \filename at parse{#1}%
+  \let\filename at simple\subfiles at filename@simple
 }
-\def\subfiles at split@#1/{%
-  \def\tmp{#1}%
-  \ifx\tmp\@nnil
-    \let\subfiles at next\relax
-  \else
-    \edef\subfiles at dir{\subfiles at dir\subfiles at base\subfiles at sep}%
-    \def\subfiles at base{#1}%
-    \def\subfiles at sep{/}%
-    \let\subfiles at next\subfiles at split@
-  \fi
-  \subfiles at next
-}
 \subfiles at split{\preamble at file}
-\subimport{\subfiles at dir}{\subfiles at base}
+\subimport{\filename at area}{\filename at base}
 {\catcode`\@=11
 \global\let\document\subfiles at document
 \global\let\enddocument\subfiles at enddocument

Modified: trunk/Master/texmf-dist/tex/latex/subfiles/subfiles.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/subfiles/subfiles.sty	2020-02-14 22:34:22 UTC (rev 53781)
+++ trunk/Master/texmf-dist/tex/latex/subfiles/subfiles.sty	2020-02-14 22:34:36 UTC (rev 53782)
@@ -26,7 +26,7 @@
 %% and the derived files subfiles.sty and subfiles.pdf
 %% 
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{subfiles}[2019/10/30 v1.5 Multi-file projects (package)]
+\ProvidesPackage{subfiles}[2020/02/14 v1.6 Multi-file projects (package)]
 \DeclareOption*{\PackageWarning{\CurrentOption ignored}}
 \ProcessOptions
 \@ifclassloaded{subfiles}{%
@@ -34,27 +34,14 @@
   \let\subfiles at enddocument\enddocument
   \let\document\subfiles at comment
   \let\enddocument\subfiles at endcomment
-}{% subfiles class not loaded
+}{% subfiles class not loaded, we typeset the main document
   \RequirePackage{import}
   \def\subfiles at split#1{%
-    \edef\subfiles at filename{#1}%
-    \def\subfiles at dir{}%
-    \def\subfiles at base{}%
-    \def\subfiles at sep{}%
-    \expandafter\subfiles at split@\subfiles at filename/\@nil/%
-  }%
-  \def\subfiles at split@#1/{%
-    \def\tmp{#1}%
-    \ifx\tmp\@nnil
-      \let\subfiles at next\relax
-    \else
-      \edef\subfiles at dir{\subfiles at dir\subfiles at base\subfiles at sep}%
-      \def\subfiles at base{#1}%
-      \def\subfiles at sep{/}%
-      \let\subfiles at next\subfiles at split@
-    \fi
-    \subfiles at next
-  }%
+    \let\subfiles at filename@simple\filename at simple
+    \def\filename at simple##1.\\{\edef\filename at base{##1}}%
+    \filename at parse{#1}%
+    \let\filename at simple\subfiles at filename@simple
+  }
 }
 \newcommand\subfile{%
   \let\subfiles at loadfile\subimport
@@ -66,15 +53,22 @@
 }
 \newcommand\subfiles at subfile[1]{%
   \begingroup
-  \renewcommand\documentclass[2][subfiles]{\ignorespaces}%
+  \let\subfiles at documentclass\documentclass
+  \let\subfiles at document\document
+  \let\subfiles at enddocument\enddocument
+  \renewcommand\documentclass[2][subfiles]{%
+    \let\documentclass\subfiles at documentclass
+    \ignorespaces
+  }%
   \renewenvironment{document}{%
-    \let\document\@onlypreamble
+    \let\document\subfiles at document
     \ignorespaces
   }{%
+    \let\enddocument\subfiles at enddocument
     \@ignoretrue
   }%
   \subfiles at split{#1}%
-  \subfiles at loadfile{\subfiles at dir}{\subfiles at base}%
+  \subfiles at loadfile{\filename at area}{\filename at base}%
   \endgroup
 }
 \def\subfiles at addimportpath#1{%
@@ -81,7 +75,12 @@
   \def\subfiles at filelist{}%
   \def\subfiles at sep{}%
   \@for\subfiles at filename:=#1\do{%
-    \edef\subfiles at filelist{\subfiles at filelist\subfiles at sep\import at path\subfiles at filename}%
+    \edef\subfiles at filelist{%
+      \subfiles at filelist
+      \subfiles at sep
+      \import at path
+      \subfiles at filename
+    }%
     \def\subfiles at sep{,}%
   }
 }
@@ -90,13 +89,7 @@
   \subfiles at addimportpath{#1}%
   \expandafter\subfiles at bibliography\expandafter{\subfiles at filelist}%
 }
-\@ifpackageloaded{bibunits}{%
-  \let\subfiles at putbib\@putbib
-  \def\@putbib[#1]{%
-    \subfiles at addimportpath{#1}%
-    \expandafter\subfiles at putbib\expandafter[\subfiles at filelist]%
-  }%
-}{}
+\def\subfix#1{\import at path#1}
 \endinput
 %%
 %% End of file `subfiles.sty'.



More information about the tex-live-commits mailing list.