summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/standalone/standalone.sty
blob: e6ad6db56ed7e0fefd602c9da630d9bb4ed486e3 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
%%
%% This is file `standalone.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% standalone.dtx  (with options: `sty')
%% 
%% Copyright (c) 2010 by Martin Scharrer <martin@scharrer-online.de>
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% 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.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%% 
%% This work has the LPPL maintenance status `maintained'.
%% 
%% The Current Maintainer of this work is Martin Scharrer.
%% 
%% This work consists of the files standalone.dtx, standalone.ins
%% and the derived file standalone.sty.
%% 
% $Id: standalone.dtx 1714 2010-03-22 14:44:37Z martin $
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{standalone} [2010/03/22 v0.2 Package to include TeX sub-files which use the 'standalone' class]
\expandafter\newif\csname ifstandalone\endcsname
\standalonefalse
\@ifundefined{ifstandalonebeamer}{%
\expandafter\newif\csname ifstandalonebeamer\endcsname
\standalonebeamerfalse
}{}%
\newcommand{\sa@documentclass}[2][]{%
  \let\document\sa@document
  \expandafter\sa@@documentclass
}
\def\sa@@documentclass{%
  \begingroup\def\sa@gobbleto{document}\sa@gobble
}
\long\def\sa@gobble#1\begin#2{%
  \def\@tempa{#2}%
  \ifx\@tempa\sa@gobbleto
    \def\next{\expandafter\endgroup\expandafter\begin\expandafter{\sa@gobbleto}}%
  \else
    \def\next{\sa@gobble}%
  \fi
  \next
}
\@ifundefined{standalone}
  {\newenvironment{standalone}[1][]{}{}}
  {}
\@ifundefined{standaloneframe}
  {\@ifundefined{beamer@newenv}
    {\newenvironment{standaloneframe}[1][]{%
      \@ifnextchar[%]
        {\sa@framegobbleopt}{\sa@framegobbleargs}}{}%
    }
    {\newenvironment<>{standaloneframe}[1][]{%
      \@ifnextchar[%]
        {\sa@framegobbleopt}{\sa@framegobbleargs}}{}%
    }
   \def\sa@framegobbleopt[#1]{\sa@framegobbleargs}
   \def\sa@framegobbleargs{%
     \@ifnextchar\bgroup
       {\sa@framegobbleargs@}%
       {}%
   }
   \def\sa@framegobbleargs@#1{%
    \@ifnextchar\bgroup
      {\@gobble}%
      {}%
   }
  }
  {}
\let\sa@orig@document\document
\let\sa@orig@enddocument\enddocument
\def\document{%
  \sa@orig@document
  \let\documentclass\sa@documentclass
  \ignorespaces
}
\def\sa@document{%
  \let\enddocument\sa@enddocument
  \sa@atbegindocument
}
\def\sa@enddocument{%
  \sa@atenddocument
  \aftergroup\sa@@enddocument
}
\def\sa@atbegindocument{%
  \ignorespaces
}%
\def\sa@atenddocument{%
  \unskip
}%
\def\sa@@enddocument{%
  %\let\document\sa@orig@document
  \let\enddocument\sa@orig@enddocument
  \endinput
}
\def\sa@processpreamble{%
  \renewcommand\usepackage[2][]{%
    \message{^^J%
      INFO: Sub-file requires the following package(s):^^J
      \space\space[##1]{##2}^^J%
    }%
  }%
  \let\RequirePackage\usepackage
}
%%\def\sa@@documentclass{\sa@processpreamble}
\endinput
%%
%% End of file `standalone.sty'.