diff options
author | Karl Berry <karl@freefriends.org> | 2019-10-24 21:48:25 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-10-24 21:48:25 +0000 |
commit | dbe0de34966f1a14cf3c9221ce6ec20ccd4febb1 (patch) | |
tree | dcec5e19e5442892a674e78ec01ac2e2af4075b6 /Master/texmf-dist/tex | |
parent | ed9573425b154ad38d9236a8eaccfe237bb415d8 (diff) |
subfiles (24oct19)
git-svn-id: svn://tug.org/texlive/trunk@52526 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/subfiles/subfiles.cls | 42 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/subfiles/subfiles.sty | 42 |
2 files changed, 65 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/latex/subfiles/subfiles.cls b/Master/texmf-dist/tex/latex/subfiles/subfiles.cls index f6e78f885f8..8086e79db2e 100644 --- a/Master/texmf-dist/tex/latex/subfiles/subfiles.cls +++ b/Master/texmf-dist/tex/latex/subfiles/subfiles.cls @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright 2002, 2012 Federico Garcia; 2018 Gernot Salzer +%% Copyright 2002, 2012 Federico Garcia; 2018, 2019 Gernot Salzer %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -26,20 +26,42 @@ %% and the derived files subfiles.sty and subfiles.pdf %% \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{subfiles}[2018/07/31 Federico Garcia, Gernot Salzer] +\ProvidesClass{subfiles}[2019/09/28 v1.3 Federico Garcia, Gernot Salzer] \DeclareOption*{\typeout{Preamble taken from file `\CurrentOption'}% \let\preamble@file\CurrentOption} \ProcessOptions -\let\old@documentclass@subfiles\documentclass +\let\subfiles@documentclass\documentclass \let\documentclass\LoadClass\relax -\input{\preamble@file} +\RequirePackage{import} +\def\subfiles@split#1{% + \edef\subfiles@filename{#1}% + \def\subfiles@dir{}% + \def\subfiles@base{}% + \def\subfiles@sep{}% + \expandafter\subfiles@split@\subfiles@filename/\@nil/% +} +\def\subfiles@split@#1/{% + \def\tmp{#1}% + \ifx\tmp\@nnil + \let\subfiles@next\relax + \else + \edef\subfiles@dir{\subfiles@dir\subfiles@base\subfiles@sep}% + \def\subfiles@base{#1}% + \def\subfiles@sep{/}% + \let\subfiles@next\subfiles@split@ + \fi + \subfiles@next +} +\subfiles@split{\preamble@file} +\subimport{\subfiles@dir}{\subfiles@base} {\catcode`\@=11 -\global\let\document\old@document@subfiles -\global\let\enddocument\old@enddocument@subfiles -\global\let\documentclass\old@documentclass@subfiles -\global\let\old@document@subfiles\undefined -\global\let\old@enddocument@subfiles\undefined -\global\let\old@documentclass@subfiles\undefined} +\global\let\document\subfiles@document +\global\let\enddocument\subfiles@enddocument +\global\let\documentclass\subfiles@documentclass +\global\let\subfiles@document\undefined +\global\let\subfiles@enddocument\undefined +\global\let\subfiles@documentclass\undefined +} \endinput %% %% End of file `subfiles.cls'. diff --git a/Master/texmf-dist/tex/latex/subfiles/subfiles.sty b/Master/texmf-dist/tex/latex/subfiles/subfiles.sty index 04d8ef19032..ea6d1d4e97e 100644 --- a/Master/texmf-dist/tex/latex/subfiles/subfiles.sty +++ b/Master/texmf-dist/tex/latex/subfiles/subfiles.sty @@ -8,7 +8,7 @@ %% %% This is a generated file. %% -%% Copyright 2002, 2012 Federico Garcia; 2018 Gernot Salzer +%% Copyright 2002, 2012 Federico Garcia; 2018, 2019 Gernot Salzer %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -26,18 +26,42 @@ %% and the derived files subfiles.sty and subfiles.pdf %% \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{subfiles}[2018/07/31 Federico Garcia, Gernot Salzer] +\ProvidesPackage{subfiles}[2019/09/28 v1.3 Federico Garcia, Gernot Salzer] \DeclareOption*{\PackageWarning{\CurrentOption ignored}} \ProcessOptions \RequirePackage{verbatim} -\newcommand{\skip@preamble}{% - \let\document\relax\let\enddocument\relax% - \newenvironment{document}{}{}% - \renewcommand{\documentclass}[2][subfiles]{}} -\newcommand\subfile[1]{\begingroup\skip@preamble\input{#1}\endgroup} +\RequirePackage{import} +\def\subfiles@split#1{% + \edef\subfiles@filename{#1}% + \def\subfiles@dir{}% + \def\subfiles@base{}% + \def\subfiles@sep{}% + \expandafter\subfiles@split@\subfiles@filename/\@nil/% +} +\def\subfiles@split@#1/{% + \def\tmp{#1}% + \ifx\tmp\@nnil + \let\subfiles@next\relax + \else + \edef\subfiles@dir{\subfiles@dir\subfiles@base\subfiles@sep}% + \def\subfiles@base{#1}% + \def\subfiles@sep{/}% + \let\subfiles@next\subfiles@split@ + \fi + \subfiles@next +} +\newcommand\subfile[1]{% + \begingroup + \renewcommand\documentclass[2][subfiles]{\ignorespaces}% + \renewenvironment{document}{\let\document\@onlypreamble\ignorespaces}{}% + \subfiles@split{#1}% + \subimport{\subfiles@dir}{\subfiles@base}% + \unskip + \endgroup +} \@ifclassloaded{subfiles}{% - \let\old@document@subfiles\document - \let\old@enddocument@subfiles\enddocument + \let\subfiles@document\document + \let\subfiles@enddocument\enddocument \let\document\comment \let\enddocument\endcomment }{} |