summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/standalone
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-03-21 23:20:57 +0000
committerKarl Berry <karl@freefriends.org>2010-03-21 23:20:57 +0000
commitc1802566752c60e5104bdfc7c68f9a10fe490239 (patch)
tree69d1b16176d4fcba98ccbd6342a4bb81e766fff6 /Master/texmf-dist/source/latex/standalone
parent860fa514b1a1be7f018476deccc66764bc2edfb5 (diff)
new latex package standalone 0.1 (21mar10)
git-svn-id: svn://tug.org/texlive/trunk@17521 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/standalone')
-rw-r--r--Master/texmf-dist/source/latex/standalone/Makefile25
-rw-r--r--Master/texmf-dist/source/latex/standalone/standalone.dtx645
-rw-r--r--Master/texmf-dist/source/latex/standalone/standalone.ins52
3 files changed, 722 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/latex/standalone/Makefile b/Master/texmf-dist/source/latex/standalone/Makefile
new file mode 100644
index 00000000000..f2404e832a1
--- /dev/null
+++ b/Master/texmf-dist/source/latex/standalone/Makefile
@@ -0,0 +1,25 @@
+all: unpack doc
+
+unpack: standalone.dtx standalone.ins
+ yes | pdflatex standalone.ins
+
+package: unpack
+class: unpack
+
+doc: standalone.pdf
+
+standalone.pdf: standalone.dtx
+ latexmk -pdf $<
+
+.PHONY: test
+
+test: unpack
+ for T in test*.tex; do echo "$$T"; pdflatex -interaction=batchmode $$T && echo "OK" || echo "Failure"; done
+
+clean:
+ ${RM} standalone.cfg standalone.tex standalone.sty standalone.cls *.log *.aux *.toc *.vrb *.nav *.pdf *.snm *.out *.fdb_latexmk *.glo
+
+
+ctanify:
+ ctanify standalone.dtx standalone.ins README Makefile
+
diff --git a/Master/texmf-dist/source/latex/standalone/standalone.dtx b/Master/texmf-dist/source/latex/standalone/standalone.dtx
new file mode 100644
index 00000000000..209824ae30a
--- /dev/null
+++ b/Master/texmf-dist/source/latex/standalone/standalone.dtx
@@ -0,0 +1,645 @@
+% \iffalse meta-comment
+%
+% 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 1704 2010-03-21 19:25:13Z martin $
+% \fi
+%
+% \iffalse
+%<cls|sty|cfg|tex>% $Id: standalone.dtx 1704 2010-03-21 19:25:13Z martin $
+%<cls|sty>\NeedsTeXFormat{LaTeX2e}
+%<cls>\ProvidesClass{standalone} [2010/03/21 v0.1 Class to compile TeX sub-files standalone]
+%<sty>\ProvidesPackage{standalone} [2010/03/21 v0.1 Package to include TeX sub-files which use the 'standalone' class]
+%<tex>\ProvidesFile{standalone.tex}[2010/03/21 v0.1 Provides if-switch to show if file is compiled standalone]%
+%<cfg>\ProvidesFile{standalone.cfg}[2010/03/21 v0.1 Default configuration file for 'standalone' class and package]%
+%<*driver>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesFile{standalone.dtx}[2010/03/21 v0.1 DTX File for 'standalone' cls/sty/tex]
+\documentclass{ltxdoc}
+\usepackage{ifpdf}
+\usepackage{listings}
+\usepackage{hyperref}
+\usepackage{tabularx}
+\usepackage{array}
+\usepackage{flafter,fnpos}
+\usepackage{booktabs}
+\usepackage{amsmath}
+\usepackage{placeins}
+\makeFNbottom
+\makeFNbelow
+
+\EnableCrossrefs
+%\CodelineIndex
+\RecordChanges
+%\OnlyDescription
+\providecommand{\env}[1]{\texttt{#1}}
+\begin{document}
+ \DocInput{\jobname.dtx}
+ \PrintChanges
+ %\newpage\PrintIndex
+\end{document}
+%</driver>
+% \fi
+%
+% \CheckSum{232}
+%
+% \CharacterTable
+% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+% Digits \0\1\2\3\4\5\6\7\8\9
+% Exclamation \! Double quote \" Hash (number) \#
+% Dollar \$ Percent \% Ampersand \&
+% Acute accent \' Left paren \( Right paren \)
+% Asterisk \* Plus \+ Comma \,
+% Minus \- Point \. Solidus \/
+% Colon \: Semicolon \; Less than \<
+% Equals \= Greater than \> Question mark \?
+% Commercial at \@ Left bracket \[ Backslash \\
+% Right bracket \] Circumflex \^ Underscore \_
+% Grave accent \` Left brace \{ Vertical bar \|
+% Right brace \} Tilde \~}
+%
+%
+% \changes{v0.1}{2010/03/21}{First released version}
+%
+% \GetFileInfo{\jobname.dtx}
+%
+% \DoNotIndex{\newcommand,\newenvironment,\def,\edef,\xdef,\DeclareRobustCommand}
+% \DoNotIndex{\expandafter,\if,\else,\fi,\ifnum,\ifx,\let,\global,\long}
+% \DoNotIndex{\newcounter,\newcount,\message,\meaning,\noexpand,\relax,\value}
+% \DoNotIndex{\setcounter,\addtocounter,\advance,\afterassignment,\AtEndOfPackage}
+% \DoNotIndex{\ProvidesPackage,\providecommand,\RequirePackage,\empty,\begin,\end}
+% \DoNotIndex{\begingroup,\bgroup,\egroup,\endgroup,\csname,\endcsname,\@tempa,\@tempb}
+% \DoNotIndex{\ignorespaces,\lccode,\sffamily,\@gobble,\@ifundefined,\@for,\or}
+% \DoNotIndex{\@firstoftwo,\@ifnextchar,\@namedef,\@nameuse,\@secondoftwo}
+% \DoNotIndex{\@temptokena,\toks@,\BODY,\do,\g@addto@macro,\lowercase,\uppercase,\the}
+%
+% \ifpdf
+% \hypersetup{%
+% pdfauthor = {Martin Scharrer <martin@scharrer-online.de>},
+% pdftitle = {The standalone class and package},
+% pdfsubject = {Documentation of LaTeX class and package 'standalone'},
+% pdfkeywords = {standalone, LaTeX, TeX}
+% }%
+% \fi
+% \clearpage
+% \null
+% \vspace*{-2em}
+% \begin{center}
+% {\LARGE\sffamily The \emph{standalone} Class and Package\\[\medskipamount]}
+% {\large Martin Scharrer \\[\medskipamount]\normalsize
+% \url{martin@scharrer-online.de}\\[.8ex]
+% \url{http://www.ctan.org/pkg/standalone/}\\[\bigskipamount]}
+% {\large Version \fileversion\ -- \filedate}\\
+% \end{center}
+% \vspace{1.2em}%
+%
+% \section{Introduction}
+% Larger \LaTeX{} documents can be split into multiple \TeX\ files which are then included in a main document with \cs{include}
+% for e.g.\ chapter files or \cs{input} for e.g.\ \TeX-coded pictures. Keeping pictures in their own sub-files improves readability
+% of the main file and simplifies the sharing of them between different documents. However, during the, sometimes lengthly,
+% drawing/coding process it has benefits to be able to compile the pictures on their own. The compile process is much quicker and
+% the resulting document only holds the picture which avoids constant page turning and zooming.
+%
+% While it is possible to write a small `main' file for each picture file, this method is a little cumbersome and clutters
+% the directories with a lot of extra files. A second method is to place the `main' components, i.e. a preamble, directly into the
+% picture files and make the main document ignore this code sections.
+%
+% The package |standalone| can be used in the main document to skip all extra preambles in included files.
+% A |standalone| class is also provided to minimise the extra preamble code needed in this files.
+% It's usage is optional, but simplifies and standardises how picture files are compiled standalone.
+% The class uses by default the |preview| package to create a output file which only contains the picture with no extra
+% margins, page numbers or anything else.
+% Both the class and the package read a configuration file |standalone.cfg| which allows the user to adjust settings and macros easily
+% on a per directory base.
+%
+% \subsection*{Similar Packages}
+% The |docmute| package by T.M.\ Trzeciak is written with the same function as the |standalone| package. However, no special class file or
+% configuration file is provided.
+%
+% \section{Usage}
+% \subsection{Quick instructions}
+% Load the |standalone| \emph{package} and all packages needed by all the sub-files in the main document and include your picture or other sub-files using |\input| as normal.
+% In the sub-files use the |standalone| \emph{class} using the normal \cs{documentclass} and load all packages needed for the particular
+% file. Finally wrap the actual file content in a |document| environment.
+%
+% When the sub-file is compiled on its own the |\documentclass| and |document| environment will be active as normal. The main file, however,
+% will skip everything from the |\documentclass| till the |\begin{document}|. The (now fake) |document| environment is redefined to be a simple
+% TeX-group. Any code after the |\end{document}| will be ignored. The real |document| environment of the main file will be unaffected and will work as normal.
+%
+% \subsection{Class Options}
+% The |standalone| class will load a real document class. By default this is |article|. The document class normally has not much
+% influence on sub-files like pictures, especially when the |preview| package is active. However, the used class can be adjusted by the user
+% with the |class=|\meta{class name} option.
+%
+% A special |beamer| option is provided to handle beamer frames and overlays correctly. See section~\ref{sec:beamer} for more information.
+%
+% All other used options are passed to the loaded class.
+%
+% \subsection{Package Options}
+% At the moment the |standalone| package does not provide any options.
+%
+% \subsection{Environments and Macros}
+%
+% \DescribeEnv{standalone}
+% The \env{standalone} environment is wrapped around the content of each sub-file when compiled standalone.
+% By default it only contains a \env{preview} environment as long the class is not called with the |preview=false| option.
+% It can be redefined in the configuration file if required.
+% When compiled as part of a main document the \env{standalone} environment does nothing (apart of being a \TeX\ group).
+%
+% \DescribeEnv{standaloneframe}
+% The \env{standaloneframe} environment is only defined when the class is called with the |beamer| option and acts as a replacement
+% of the \env{frame} environment of beamer when compiled standalone. All optional arguments of \env{frame} are supported.
+% When compiled as part of a main document it does nothing except of gobbling its arguments.
+%
+% \bigskip
+% \DescribeMacro{\ifstandalone}
+% Both the class and the package provide the if-switch \cs{ifstandalone}, which can be used to only include code if the file is
+% compiled standalone. The switch is set to \cs{iftrue} by the class and to \cs{iffalse} by the package.
+%
+% The additional file |standalone.tex| also defines this switch by checking if \cs{documentclass} was already used. It can be included
+% with |\input{standalone}| and is intended for specialised files which do not use the |standalone| class.
+%
+% \def\lstlistingname{Example}
+% \begin{lstlisting}[language={[latex]tex},gobble=4,frame=lines,caption={Use of \emph{standalone} class.}]
+% % A sub-file (e.g. picture) using the 'standalone' class:
+% % Use 'standalone' as document class:
+% \documentclass{standalone}
+%
+% % Load packages needed for this TeX file:
+% \usepackage{tikz}
+%
+% % Surround TeX code with 'document' environment as usually:
+% \begin{document}
+% % Add your TeX code, e.g. a picture:
+% \begin{tikzpicture}
+% \draw (0,0) rectangle (2,1) node [midway] {Example};
+% \end{tikzpicture}
+% \end{document}
+% \end{lstlisting}
+%
+% \begin{lstlisting}[language={[latex]tex},gobble=4,frame=lines,caption={Effective code if compiled standalone.}]
+% \documentclass{article}
+%
+% \newenvironment{standalone}{\begin{preview}}{\end{preview}}
+% \input{standalone.cfg}
+% % which by defaults loads: \PassOptionsToPackage{active,tightpage}{preview}
+% \usepackage{preview}
+%
+% \usepackage{tikz}
+%
+% \begin{document}
+% \begin{standalone}
+% \begin{tikzpicture}
+% \draw (0,0) rectangle (2,1) node [midway] {Example};
+% \end{tikzpicture}
+% \end{standalone}
+% \end{document}
+% \end{lstlisting}
+%
+% \begin{lstlisting}[language={[latex]tex},gobble=4,frame=lines,caption={Effective code if included in a main document.}]
+% \begingroup
+% \begin{tikzpicture}
+% \draw (0,0) rectangle (2,1) node [midway] {Example};
+% \end{tikzpicture}
+% \endgroup
+% \endinput
+% \end{lstlisting}
+%
+%
+% \subsection{Usage of the package}
+% \begin{lstlisting}[language={[latex]tex},gobble=4,frame=lines,caption={Use of \emph{standalone} package.}]
+% % Main file
+% % Real document class:
+% \documentclass{article}
+%
+% % Use the 'standalone' package:
+% \usepackage{standalone}
+%
+% % Load all packages needed for all sub-files:
+% \usepackage{tikz}
+%
+% % Inside the real 'document' environment read the sub-file with '\input'
+% \begin{document}
+% % ...
+% \begin{figure}
+% \input{subfile}
+% \caption{A subfile}
+% \end{figure}
+% % ...
+% \end{document}
+% \end{lstlisting}
+%
+%
+% \subsection{Support for Beamer Presentations}\label{sec:beamer}
+% Presentation can be written in \LaTeX\ using the |beamer| class. Each presentation frame is wrapped in a |frame| environment. Overlay effects
+% can be added using special macros. This effects result in multiple pages per frame. Pictures with such overlay effects can not be
+% compiled standalone using the normal settings. Instead the |standalone| class must load the |beamer| class and wrap the content also in
+% a |frame| environment while skipping the |preview| environment. To activate this settings load the |standalone| class with the |beamer| option.
+% Because the |frame| environment is quite special (it normally collects all it's content and calls the \cs{frame}) and must also support
+% verbatim content it is not easily possible to redefined the |document| environment to include |frame|. Also |frame| accepts options which |document| doesn't.
+% Therefore a second environment called |standaloneframe| is used in the beamer picture files. It will be equal to |frame| in standalone mode, but
+% without effect otherwise.
+%
+% \begin{lstlisting}[language={[latex]tex},gobble=4,frame=lines,caption={Use of \emph{standalone} class.}]
+% % Use of 'standalone' class with a beamer overlay:
+% \documentclass[beamer]{standalone}
+%
+% % Load packages needed for this TeX file:
+% \usepackage{tikz}
+%
+% % Surround TeX code with 'document' environment as usually:
+% \begin{document}
+% \begin{standaloneframe}[options, e.g. 'fragile' for verbatim content]
+% % Add your TeX code:
+% \only<1>{ One }%
+% \only<2>{ Two }%
+% \end{standaloneframe}
+% \end{document}
+% \end{lstlisting}
+%
+% \begin{lstlisting}[language={[latex]tex},gobble=4,frame=lines,caption={Effective beamer code if compiled standalone.}]
+% \documentclass{beamer}
+%
+% \input{standalone.cfg}
+%
+% \usepackage{tikz}
+%
+% \begin{document}
+% \begin{frame}[your options]
+% \only<1>{ One }%
+% \only<2>{ Two }%
+% \end{frame}
+% \end{document}
+% \end{lstlisting}
+%
+% \begin{lstlisting}[language={[latex]tex},gobble=4,frame=lines,caption={Effective code if included in a beamer presentation.}]
+% \begingroup
+% \only<1>{ One }%
+% \only<2>{ Two }%
+% \endgroup
+% \endinput
+% \end{lstlisting}
+%
+% \subsection{\texttt{standalone.tex}}
+% \begin{lstlisting}[language={[latex]tex},gobble=4,frame=lines,caption={Usage of 'standalone.tex'.}]
+% \input{standalone} % use before any '\documentclass'
+% \ifstandalone
+% % Used only if compiled standalone
+% \fi
+% \end{lstlisting}
+%
+% \StopEventually{}
+% \FloatBarrier
+% \clearpage
+%
+% \section{Implementation}
+%
+% \subsection{The Package File}
+% \iffalse
+%<*sty>
+% \fi
+% \begin{macrocode}
+\expandafter\newif\csname ifstandalone\endcsname
+\standalonefalse
+% \end{macrocode}
+%
+% \begin{macro}{\sa@documentclass}
+% \begin{macrocode}
+\newcommand{\sa@documentclass}[2][]{%
+ \let\document\sa@document
+ \expandafter\sa@@documentclass
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sa@@documentclass}
+% \begin{macrocode}
+\def\sa@@documentclass{%
+ \begingroup\def\sa@gobbleto{document}\sa@gobble
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sa@gobble}
+% \begin{macrocode}
+\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
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\@ifundefined{standalone}
+ {\newenvironment{standalone}[1][]{}{}}
+ {}
+% \end{macrocode}
+%
+% Gobbles all arguments: |<...>[<...>][...]{...}{...}|. Please note that the last two |{ }| arguments are also optional.
+% \begin{macrocode}
+\@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}%
+ {}%
+ }
+ }
+ {}
+% \end{macrocode}
+%
+% \begin{macro}{\sa@orig@document}
+% \begin{macrocode}
+\let\sa@orig@document\document
+% \end{macro}
+%
+% \begin{macro}{\sa@orig@enddocument}
+% \begin{macrocode}
+\let\sa@orig@enddocument\enddocument
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\document}
+% \begin{macrocode}
+\def\document{%
+ \sa@orig@document
+ \let\documentclass\sa@documentclass
+ \ignorespaces
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sa@document}
+% \begin{macrocode}
+\def\sa@document{%
+ \let\enddocument\sa@enddocument
+ \sa@atbegindocument
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sa@enddocument}
+% \begin{macrocode}
+\def\sa@enddocument{%
+ \sa@atenddocument
+ \aftergroup\sa@@enddocument
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sa@atbegindocument}
+% \begin{macrocode}
+\def\sa@atbegindocument{%
+ \ignorespaces
+}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sa@atenddocument}
+% \begin{macrocode}
+\def\sa@atenddocument{%
+ \unskip
+}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sa@@enddocument}
+% \begin{macrocode}
+\def\sa@@enddocument{%
+ %\let\document\sa@orig@document
+ \let\enddocument\sa@orig@enddocument
+ \endinput
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\sa@processpreamble}
+% \begin{macrocode}
+\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
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+%%\def\sa@@documentclass{\sa@processpreamble}
+% \end{macrocode}
+%
+% \iffalse
+%</sty>
+% \fi
+%
+% \subsection{The Class File}
+% \iffalse
+%<*cls>
+% \fi
+% \begin{macrocode}
+\def\sa@classoptionslist{}
+\RequirePackage{kvoptions}
+\SetupKeyvalOptions{prefix=sa@}
+\DeclareBoolOption[true]{preview}
+% \end{macrocode}
+%
+% \begin{environment}{standalone}
+% The \env{standalone} environment is defined by default to be without effect.
+% The \cs{endstandalone} macro is set to |\relax|, so a redefinition with
+% \cs{renewenvironment} can be detected later.
+% \begin{macrocode}
+\let\standalone\empty
+\let\endstandalone\relax
+% \end{macrocode}
+% \end{environment}
+%
+% \begin{macro}{\sa@cls@document}
+% \begin{macro}{\sa@cls@enddocument}
+% \begin{macrocode}
+\def\sa@cls@document{\standalone}
+\def\sa@cls@enddocument{\endstandalone}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+% The |beamer| option defines the \env{standalone} environment as a replacement
+% of \env{frame}.
+% \begin{macrocode}
+\DeclareVoidOption{beamer}{%
+ \def\sa@class{beamer}%
+ \sa@previewfalse
+ \newenvironment{standaloneframe}{%
+ \@ifnextchar<%
+ {\@standaloneframe}%
+ {\@@standaloneframe{}}%
+ }{\end{frame}}%
+ \def\@standaloneframe<##1>{%
+ \@@standaloneframe{<##1>}%
+ }
+ \def\@@standaloneframe##1{%
+ \@ifnextchar[%]
+ {\@@@standaloneframe{##1}}%
+ {\@@@standaloneframe{##1}[]}%
+ }%
+ \def\@@@standaloneframe##1[{%
+ \@ifnextchar<%
+ {\@@@@standaloneframe{##1}[}%
+ {\@@@@@@standaloneframe{##1}[}%
+ }%
+ \def\@@@@standaloneframe##1[##2]{%
+ \@ifnextchar[%]
+ {\@@@@@standaloneframe{##1}{##2}}%
+ {\begin{frame}##1[##2][environment=standaloneframe]}%
+ }%
+ \def\@@@@@standaloneframe##1##2[##3]{%
+ \begin{frame}##1[##2][environment=standaloneframe,##3]%
+ }%
+ \def\@@@@@@standaloneframe##1[##2]{%
+ \begin{frame}##1[environment=standaloneframe,##2]%
+ }%
+}
+% \end{macrocode}
+%
+% \begin{macrocode}
+\DeclareStringOption[article]{class}
+\DeclareStringOption[]{frameoptions}
+\DeclareDefaultOption{%
+ \xdef\sa@classoptionslist{\sa@classoptionslist,\CurrentOption}%
+}
+\input{standalone.cfg}
+\ProcessKeyvalOptions*\relax
+% \end{macrocode}
+%
+% \begin{macrocode}
+\let\@classoptionslist\sa@classoptionslist
+\xdef\@tempa{[\sa@classoptionslist]{\sa@class}}
+\expandafter\LoadClass\@tempa
+\@nameuse{sa@afterclassloaded}
+% \end{macrocode}
+%
+% \subsubsection*{Preview Code}
+% The \env{standalone} environment is redefined to use the |preview| environment as
+% long it was not redefined in the configuration file.
+% \begin{macrocode}
+\ifsa@preview
+ \@ifundefined{endstandalone}{%
+ \renewenvironment{standalone}
+ {\preview }
+ {\endpreview}
+ }{}%
+ \RequirePackage{preview}
+\fi
+% \end{macrocode}
+%
+% \begin{macrocode}
+\RequirePackage{standalone}[2010/03/21]
+\standalonetrue
+% \end{macrocode}
+%
+% \begin{macro}{\document}
+% \begin{macrocode}
+\def\document{%
+ \sa@orig@document
+ \let\documentclass\sa@documentclass
+ \sa@cls@document
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\enddocument}
+% \begin{macrocode}
+\def\enddocument{%
+ \sa@cls@enddocument
+ \sa@orig@enddocument
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \iffalse
+%</cls>
+% \fi
+%
+% \subsection{Simple TeX File}
+% \iffalse
+%<*tex>
+% \fi
+% \begin{macrocode}
+\expandafter\ifx\csname ifstandalone\endcsname\relax
+% \end{macrocode}
+% \begin{macrocode}
+\expandafter\newif\csname ifstandalone\endcsname
+% \end{macrocode}
+% \begin{macrocode}
+\expandafter\ifx\csname @twoclasseserror\endcsname\documentclass
+\else
+ \standalonetrue
+\fi
+% \end{macrocode}
+% \begin{macrocode}
+\fi
+% \end{macrocode}
+% \iffalse
+%</tex>
+% \fi
+%
+% \subsection{Config File}
+% Default content of the configuration file. Users can place there own
+% |standalone.cfg| in their |texmf| directory or in the local document directory
+% to define their own settings as described above. To load the default config file
+% from a user config file use |\input{standalone/standalone.cfg}|.
+% \iffalse
+%<*cfg>
+% \fi
+% \begin{macrocode}
+\PassOptionsToPackage{active,tightpage}{preview}%
+% \end{macrocode}
+% \iffalse
+%</cfg>
+% \fi
+%
+% \iffalse
+%<cfg>% vim: ft=tex
+% \fi
+% \Finale
+% \endinput
diff --git a/Master/texmf-dist/source/latex/standalone/standalone.ins b/Master/texmf-dist/source/latex/standalone/standalone.ins
new file mode 100644
index 00000000000..0900fcf2901
--- /dev/null
+++ b/Master/texmf-dist/source/latex/standalone/standalone.ins
@@ -0,0 +1,52 @@
+%% $Id: standalone.ins 1690 2010-03-20 13:52:08Z martin $
+\input docstrip.tex
+\preamble
+
+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.
+
+\endpreamble
+\keepsilent
+
+\generate{%
+ \file{standalone.cls}{\from{standalone.dtx}{cls}}%
+ \file{standalone.sty}{\from{standalone.dtx}{sty}}%
+ \nopreamble\nopostamble
+ \file{standalone.tex}{\from{standalone.dtx}{tex}}%
+ \file{standalone.cfg}{\from{standalone.dtx}{cfg}}%
+}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* standalone.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file standalone.dtx *}
+\Msg{* through LaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile
+%% vim: ft=tex
+