%%
%% This is file `childdoc.def',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% childdoc.dtx  (with options: `package')
%% 
%% Copyright (C) 2017 Niklas Beisert
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% 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

\newif\ifchilddoc

\edef\childdocname{\scantokens\expandafter{\jobname\noexpand}}

\newcommand{\childdoc}[1]
{
  \def\childdoc##1{\endinput}
  {
    \def\childdoctmp{#1}
    \ifx\childdocname\childdoctmp\else
      \global\childdoctrue
    \fi
  }
  \ifchilddoc
    \includeonly{\childdocname}
    \def\jobname{#1}
  \fi
}

\newcommand{\childdocredirect}[2][]
{
  {
    \def\childdoctmp{#1}
    \def\childdocempty{}
    \ifx\childdoctmp\childdocempty
      \gdef\jobname{#2}
    \else
      \def\childdocextract #1##1~~~{\gdef\jobname{#2##1}}
      \expandafter\childdocextract\childdocname~~~
    \fi
  }
  \let\childdocname\jobname
  \input{\jobname}
  \endinput
}

\endinput
%%
%% End of file `childdoc.def'.
