summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/latex/docmute/README12
-rw-r--r--Master/texmf-dist/doc/latex/docmute/docmute.pdfbin146598 -> 92811 bytes
-rw-r--r--Master/texmf-dist/source/latex/docmute/docmute.dtx126
-rw-r--r--Master/texmf-dist/source/latex/docmute/docmute.ins1
-rw-r--r--Master/texmf-dist/tex/latex/docmute/docmute.sty40
5 files changed, 104 insertions, 75 deletions
diff --git a/Master/texmf-dist/doc/latex/docmute/README b/Master/texmf-dist/doc/latex/docmute/README
index 3784915fb38..4c82bd1671a 100644
--- a/Master/texmf-dist/doc/latex/docmute/README
+++ b/Master/texmf-dist/doc/latex/docmute/README
@@ -1,3 +1,9 @@
-The docmute package enables to input or include standalone
-LaTeX documents as if they consisted of only the content
-between \begin{document} and \end{document}.
+Input or include stand-alone LaTeX documents. Only the content
+of the document environment is retained and the rest is
+discarded.
+
+To install the package you only need to put docmute.sty style
+file where LaTeX can find it. To extract the files and typeset
+the documentation run pdflatex on docmute.dtx. Alternatively,
+run tex on it to extract only.
+
diff --git a/Master/texmf-dist/doc/latex/docmute/docmute.pdf b/Master/texmf-dist/doc/latex/docmute/docmute.pdf
index 00c2d7849ab..0540bfcfa2f 100644
--- a/Master/texmf-dist/doc/latex/docmute/docmute.pdf
+++ b/Master/texmf-dist/doc/latex/docmute/docmute.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/docmute/docmute.dtx b/Master/texmf-dist/source/latex/docmute/docmute.dtx
index cc4a1e0e71b..720b52c54d2 100644
--- a/Master/texmf-dist/source/latex/docmute/docmute.dtx
+++ b/Master/texmf-dist/source/latex/docmute/docmute.dtx
@@ -1,6 +1,7 @@
% \iffalse
%<*internal>
\iffalse
+% !TEX program = pdflatex
%</internal>
%
%<*license>
@@ -18,19 +19,27 @@ T.M. Trzeciak.
This work consists of the file docmute.dtx
and the derived files docmute.ins,
- docmute.pdf
+ docmute.pdf,
docmute.sty.
%</license>
%
%<*readme>
-The docmute package enables to input or include standalone
-LaTeX documents as if they consisted of only the content
-between \begin{document} and \end{document}.
+Input or include stand-alone LaTeX documents. Only the content
+of the document environment is retained and the rest is
+discarded.
+
+To install the package you only need to put docmute.sty style
+file where LaTeX can find it. To extract the files and typeset
+the documentation run pdflatex on docmute.dtx. Alternatively,
+run tex on it to extract only.
%</readme>
%
%<*internal>
\fi
-\begingroup
+\def\nameofplainTeX{plain}
+\ifx\fmtname\nameofplainTeX\else
+ \expandafter\begingroup
+\fi
%</internal>
%
%<*batchfile>
@@ -44,7 +53,11 @@ between \begin{document} and \end{document}.
%<*internal>
\generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
\generate{\file{README.TXT}{\from{\jobname.dtx}{readme}}}
-\endgroup
+\ifx\fmtname\nameofplainTeX
+ \expandafter\endbatchfile
+\else
+ \expandafter\endgroup
+\fi
%</internal>
% \fi
%
@@ -64,21 +77,24 @@ between \begin{document} and \end{document}.
\GetFileInfo{docmute.sty}
\title{The \textsf{docmute} package%
\thanks{This file describes version \fileversion, last revised \filedate.}}
-\author{T.\,M. Trzeciak\thanks{E-mail: \texttt{t34www@googlemail.com}}}
+\author{Tomasz M. Trzeciak\thanks{E-mail: \texttt{t34www@googlemail.com}}}
+\date{\filedate}
\maketitle
\section{Intoduction}
-The structure of \LaTeX\ documents doesn't allow one document to be included as a part of another (at least not without some hacking). This package tries to remove this limitation and enable the standard |\input| and |\include| commands to be used on standalone documents just as if they contained no preamble.
+The structure of \LaTeX\ documents doesn't allow one document to be included as a part of another. This package tries to remedy this limitation and enables standalone documents to be used with the standard |\input| and |\include| commands just as if they had no preamble.
+
+This package is intentionally kept simple. If you require more smarts, there are other possibilities that might suit you better, such as the \textsf{standalone} package and document class by M.\ Scharrer or the \textsf{combine} class by W.\ Robertson and P.\,R.\ Wilson.
\section{Usage}
-The package is loaded with the usual |\usepackage{docmute}|. It redefines the |\documentclass| command in such a way that everything between this command and the |\begin{document}| is skipped, as well as everything after the |\end{document}|. No attempts are made to analyse the actual content of the preamble. It is up to you to ensure that the main document loads all packages required by subsidiary documents.
+The package is loaded with the usual |\usepackage{docmute}|. It redefines the |\documentclass| command in such a way that everything between this command and the |\begin{document}| is skipped, as well as everything after the |\end{document}|. No attempts are made to analyse the actual content of the preamble---it is simply discarded. It is up to the user to ensure that the main document loads all packages required by subsidiary documents. To easily share (part of) a preamble between documents, simply put it in a separate file and |\input| it in each document.
\DescribeMacro{\docmute}
-In rare cases some commands might be already present already before the |\documentclass| command. These commands would be then normally executed by the main document. You can prevent that by putting |\csname docmute\endcsname| at the top of the inputted document. The |\docmute| command has the same effect as the redefined |\documentclass|. Executing it through the control sequence forming primitive rather than directly ensures that standalone compilation is still possible. In that case |\csname docmute\endcsname| will have the same effect as |\relax|.
+In rare cases there might be some commands present already before the |\documentclass| command and these commands will be executed then by the main document. You can prevent that by putting |\csname docmute\endcsname| at the top of the inputted document. The |\docmute| command has the same effect as the redefined |\documentclass|. Executing it through the control sequence forming primitive rather than directly ensures that standalone compilation is still possible, even though the |\docmute| command is not defined yet (in which case |\csname docmute\endcsname| will have the same effect as |\relax|).
-By default, nesting of inputted documents is not allowed, i.e. inputted documents cannot themselves input other documents. This behaviour can be changed with the package option |nested|. With this option inputted documents are surrounded by a group and nesting becomes possible. Note, that due to grouping only global macro (re)definitions will be visible in the parent document.
+Starting with version v1.2 nesting of inputted documents is allowed by default and doesn't require an explicit option nor does it introduce an additional level of grouping as in previous versions. For backwards compatibility the |nested| option is still accepted but it has no effect.
\section{Known limitations}
@@ -103,7 +119,7 @@ The |\documentclass| and/or |\csname docmute\endcsname| command has to be in th
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{docmute}[2009/10/08 v1.1 Input standalone documents]
+\ProvidesPackage{docmute}[2010/04/12 v1.2 Input stand-alone documents]
% \end{macrocode}
%
% Macro used for comparison to see if we already reached
@@ -121,78 +137,84 @@ The |\documentclass| and/or |\csname docmute\endcsname| command has to be in th
\def\docmute@thisenv{#2}%
% \end{macrocode}
%
-% If |\begin{document}| was reached we can stop gobbling,
-% otherwise we continue with tail recursive call.
+% \noindent If |\begin{document}| was reached we can stop
+% gobbling, otherwise we continue with tail recursive call.
%
% \begin{macrocode}
\ifx\docmute@thisenv\docmute@docenv
- \docmute@afterpreamble
+ \begin{document}%
\else
\expandafter\docmute@gobblepreamble
\fi
}
% \end{macrocode}
%
-% After gobbling stops, |\enddocument| is redefined to stop
-% input when it's executed. Excess spaces, if any, are taken
-% care of by |\ignorespaces|.
-%
-% \begin{macrocode}
-\def\docmute@afterpreamble{%
- \docmute@atbegindoc
- \def\enddocument{%
- \docmute@atenddoc
- \aftergroup\ignorespaces
- \endinput
- }%
- \ignorespaces
-}
-% \end{macrocode}
-%
-% Save original definitions of |\document| and |\enddocument|
+% Save the original definitions of |\document| and
+% |\enddocument|
%
% \begin{macrocode}
\let\docmute@document=\document
\let\docmute@enddocument=\enddocument
% \end{macrocode}
%
-% Hooks to implement nesting.
-%
-% \begin{macrocode}
-\let\docmute@atbegindoc=\relax
-\def\docmute@atenddoc{%
- \let\enddocument=\docmute@enddocument
- \begingroup
-}
-% \end{macrocode}
-%
-% Define the |\docmute| command
+% Define the |\docmute| command.
%
% \begin{macrocode}
\let\docmute=\docmute@gobblepreamble
% \end{macrocode}
%
-% Redefine the |\documentclass| command at the beginning of
-% the document. |\AtBeginDocument| happens to early to be used
-% for that, so we need to append directly to the |\document|.
+% Redefine the |\documentclass| command and |document|
+% environment at the beginning of the document.
+% |\AtBeginDocument| happens to early to be used for that,
+% so we need to append directly to the |\document|.
%
% \begin{macrocode}
\def\document{%
\docmute@document
+ \countdef\docmute@nestinglevel=1
\let\documentclass=\docmute
+ \renewenvironment{document}{%
+% \end{macrocode}
+%
+% Avoid grouping coming from the environment, store definition
+% of |\@currenvir| at current nesting level and redefine it
+% as |document| to keep check at |\end{document}| happy.
+% Keep track of document nesting level and take care of excess
+% spaces.
+%
+% \begin{macrocode}
+ \endgroup
+ \advance \docmute@nestinglevel 1%
+ \ignorespaces
+ }{%
+ \advance \docmute@nestinglevel -1%
+% \end{macrocode}
+%
+% At the top level execute the original |\enddocument|.
+% Otherwise match the grouping from |\end|, set ignore blanks
+% switch to true, redefine |\@currenvir| to |document|
+% to keep the check at |\end{document}| happy and finally
+% |\endinput|.
+%
+% \begin{macrocode}
+ \ifnum\docmute@nestinglevel=0
+ \docmute@enddocument
+ \else
+ \begingroup
+ \@ignoretrue
+ \def\@currenvir{document}%
+ \endinput
+ \fi
+ }%
\ignorespaces
}
% \end{macrocode}
%
-% Finally, handle the only option we have and that's it.
+% Handle options.
%
% \begin{macrocode}
-\DeclareOption{nested}{%
- \let\docmute@atbegindoc=\begingroup
- \let\docmute@atenddoc=\relax
-}
+\DeclareOption{nested}{}% for backwards compatibility only
\ProcessOptions
-\endinput
% \end{macrocode}
% \iffalse
%</package>
diff --git a/Master/texmf-dist/source/latex/docmute/docmute.ins b/Master/texmf-dist/source/latex/docmute/docmute.ins
index 0c9335da606..2a5b3860fb3 100644
--- a/Master/texmf-dist/source/latex/docmute/docmute.ins
+++ b/Master/texmf-dist/source/latex/docmute/docmute.ins
@@ -3,3 +3,4 @@
\nopreamble\nopostamble
\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
\endbatchfile
+
diff --git a/Master/texmf-dist/tex/latex/docmute/docmute.sty b/Master/texmf-dist/tex/latex/docmute/docmute.sty
index 644178c3862..5bbaf7cd1a4 100644
--- a/Master/texmf-dist/tex/latex/docmute/docmute.sty
+++ b/Master/texmf-dist/tex/latex/docmute/docmute.sty
@@ -1,38 +1,38 @@
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{docmute}[2009/10/08 v1.1 Input standalone documents]
+\ProvidesPackage{docmute}[2010/04/12 v1.2 Input stand-alone documents]
\def\docmute@docenv{document}
\long\def\docmute@gobblepreamble#1\begin#2{%
\def\docmute@thisenv{#2}%
\ifx\docmute@thisenv\docmute@docenv
- \docmute@afterpreamble
+ \begin{document}%
\else
\expandafter\docmute@gobblepreamble
\fi
}
-\def\docmute@afterpreamble{%
- \docmute@atbegindoc
- \def\enddocument{%
- \docmute@atenddoc
- \aftergroup\ignorespaces
- \endinput
- }%
- \ignorespaces
-}
\let\docmute@document=\document
\let\docmute@enddocument=\enddocument
-\let\docmute@atbegindoc=\relax
-\def\docmute@atenddoc{%
- \let\enddocument=\docmute@enddocument
- \begingroup
-}
\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
+ \docmute@enddocument
+ \else
+ \begingroup
+ \@ignoretrue
+ \def\@currenvir{document}%
+ \endinput
+ \fi
+ }%
\ignorespaces
}
-\DeclareOption{nested}{%
- \let\docmute@atbegindoc=\begingroup
- \let\docmute@atenddoc=\relax
-}
+\DeclareOption{nested}{}% for backwards compatibility only
\ProcessOptions
+