summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/childdoc/childdoc.def
blob: d7d0c9706bc4c28c644135e1406b46e635e7303f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
%%
%% 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'.