summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/docmute/docmute.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/docmute/docmute.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/docmute/docmute.sty')
-rw-r--r--macros/latex/contrib/docmute/docmute.sty39
1 files changed, 39 insertions, 0 deletions
diff --git a/macros/latex/contrib/docmute/docmute.sty b/macros/latex/contrib/docmute/docmute.sty
new file mode 100644
index 0000000000..41438a2482
--- /dev/null
+++ b/macros/latex/contrib/docmute/docmute.sty
@@ -0,0 +1,39 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{docmute}[2012/03/22 v1.4 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
+ \newcount\docmute@nestinglevel
+ \docmute@nestinglevel=0\relax
+ \let\documentclass=\docmute
+ \renewenvironment{document}{%
+ \endgroup
+ \advance \docmute@nestinglevel 1\relax
+ \ignorespaces
+ }{%
+ \ifnum\docmute@nestinglevel=0
+ \expandafter\docmute@enddocument
+ \else
+ \advance \docmute@nestinglevel -1\relax
+ \begingroup
+ \@ignoretrue
+ \def\@currenvir{document}%
+ \endinput
+ \fi
+ }%
+ \ignorespaces
+}
+\DeclareOption{nested}{}% for backwards compatibility only
+\ProcessOptions
+