diff options
author | Karl Berry <karl@freefriends.org> | 2017-06-06 21:56:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-06-06 21:56:06 +0000 |
commit | ae5c3b73315e3e216f364fa80bc292037be5f590 (patch) | |
tree | b5776df6912612108fa86512b5387a084ebdf9f4 /Master/texmf-dist/tex/latex | |
parent | 5974e2228b3df4e0ad1256bec5eacef9e0b4842e (diff) |
childdoc (22may17)
git-svn-id: svn://tug.org/texlive/trunk@44512 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/childdoc/childdoc.def | 71 |
1 files changed, 54 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/latex/childdoc/childdoc.def b/Master/texmf-dist/tex/latex/childdoc/childdoc.def index d7d0c9706bc..ada4e484fed 100644 --- a/Master/texmf-dist/tex/latex/childdoc/childdoc.def +++ b/Master/texmf-dist/tex/latex/childdoc/childdoc.def @@ -16,46 +16,83 @@ %% and version 1.3 or later is part of all distributions of LaTeX %% version 2005/12/01 or later. %% -\ProvidesFile{childdoc.def}[2017/04/27 v1.0 child document driver] - -\ifdefined\childdoc\endinput\fi +\ifdefined\childdocmain\endinput\fi +\ProvidesFile{childdoc.def}[2017/05/21 v1.5 child document driver] \newif\ifchilddoc \edef\childdocname{\scantokens\expandafter{\jobname\noexpand}} -\newcommand{\childdoc}[1] +\newcommand{\childdocmain}[1] { - \def\childdoc##1{\endinput} - { + \def\childdocmain##1{\endinput} + \def\childdocof##1{} + \begingroup \def\childdoctmp{#1} - \ifx\childdocname\childdoctmp\else - \global\childdoctrue + \ifx\childdocname\childdoctmp + \def\childdoctmp{\childdocfalse} + \else + \def\childdoctmp{\childdoctrue} \fi - } + \expandafter + \endgroup + \childdoctmp \ifchilddoc \includeonly{\childdocname} \def\jobname{#1} \fi } -\newcommand{\childdocredirect}[2][] +\newcommand{\childdoc}{\childdocmain} + +\newcommand{\childdocof}[1] +{ + \input{#1} +} + +\newcommand{\childdocforward}[2][] { - { + \def\jobname{#2} + \def\childdocname{#2} + \begingroup \def\childdoctmp{#1} \def\childdocempty{} \ifx\childdoctmp\childdocempty - \gdef\jobname{#2} + \def\childdoctmp{\input{#2}} \else - \def\childdocextract #1##1~~~{\gdef\jobname{#2##1}} - \expandafter\childdocextract\childdocname~~~ + \def\childdoctmp{\input{#1}} \fi - } - \let\childdocname\jobname - \input{\jobname} + \expandafter + \endgroup + \childdoctmp \endinput } +\newcommand{\childdocforwardprefix}[3][] +{ + \begingroup + \def\childdocextract #2##1~~~{\def\childdoctmp{\childdocforward[#1]{#3##1}}} + \expandafter\childdocextract\childdocname~~~ + \expandafter + \endgroup + \childdoctmp +} + +\newcommand{\childdocredirect}[2][] +{ + \begingroup + \def\childdoctmp{#1} + \def\childdocempty{} + \ifx\childdoctmp\childdocempty + \def\childdoctmp{\childdocforward{#2}} + \else + \def\childdoctmp{\childdocforwardprefix{#1}{#2}} + \fi + \expandafter + \endgroup + \childdoctmp +} + \endinput %% %% End of file `childdoc.def'. |