blob: 10fd17640503723c3aa5f30ba2fbbde4833caf94 (
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
|
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{docmute}[2012/01/28 v1.3 Input stand-alone documents]
\def\docmute@docenv{document}
\long\def\docmute@gobblepreamble#1\begin#2{%
\def\docmute@thisenv{#2}%
\ifx\docmute@thisenv\docmute@docenv
\begin{document}%
\else
\expandafter\docmute@gobblepreamble
\fi
}
\let\docmute@document=\document
\let\docmute@enddocument=\enddocument
\let\docmute=\docmute@gobblepreamble
\def\document{%
\docmute@document
\countdef\docmute@nestinglevel=1
\let\documentclass=\docmute
\renewenvironment{document}{%
\endgroup
\advance \docmute@nestinglevel 1%
\ignorespaces
}{%
\advance \docmute@nestinglevel -1%
\ifnum\docmute@nestinglevel=0
\expandafter\docmute@enddocument
\else
\begingroup
\@ignoretrue
\def\@currenvir{document}%
\endinput
\fi
}%
\ignorespaces
}
\DeclareOption{nested}{}% for backwards compatibility only
\ProcessOptions
|