summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-03-01 23:44:06 +0000
committerKarl Berry <karl@freefriends.org>2011-03-01 23:44:06 +0000
commit8f4172befed36d7074c76019c9ffd6b67a22ce17 (patch)
tree8ecf1ba5d6f28b0ae7b632569d8ff5b2322992ed /Master/texmf-dist/source/latex
parentf59620f253808e843e73159d36397cb4f15ec93a (diff)
standalone 0.4 (1mar11)
git-svn-id: svn://tug.org/texlive/trunk@21573 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/standalone/Makefile16
-rw-r--r--Master/texmf-dist/source/latex/standalone/README6
-rw-r--r--Master/texmf-dist/source/latex/standalone/gincltex.dtx355
-rw-r--r--Master/texmf-dist/source/latex/standalone/gincltex.ins49
-rw-r--r--Master/texmf-dist/source/latex/standalone/standalone.dtx339
-rw-r--r--Master/texmf-dist/source/latex/standalone/standalone.ins2
6 files changed, 663 insertions, 104 deletions
diff --git a/Master/texmf-dist/source/latex/standalone/Makefile b/Master/texmf-dist/source/latex/standalone/Makefile
index f399ae376d5..a9df0a0e9cc 100644
--- a/Master/texmf-dist/source/latex/standalone/Makefile
+++ b/Master/texmf-dist/source/latex/standalone/Makefile
@@ -21,23 +21,19 @@ ${PACKEDFILES}: standalone.dtx standalone.ins
unpack: ${PACKEDFILES}
# 'doc' and 'standalone.pdf' call itself until everything is stable
-doc: standalone.pdf
+doc: standalone.pdf
@${MAKE} --no-print-directory standalone.pdf
pdfopt: doc
@-pdfopt standalone.pdf .temp.pdf && mv .temp.pdf standalone.pdf
-standalone.pdf: standalone.dtx standalone.gls standalone.ind
- ${LATEXMK} standalone.dtx
-
-standalone.idx standalone.glo: standalone.dtx
- ${LATEXMK} standalone.dtx
-
-standalone.ind: standalone.idx
+%.pdf: %.dtx
+ ${PDFLATEX} $<
-makeindex -s gind.ist -o "$@" "$<"
-
-standalone.gls: standalone.glo
-makeindex -s gglo.ist -o "$@" "$<"
+ ${PDFLATEX} $<
+ ${PDFLATEX} $<
+
.PHONY: test
diff --git a/Master/texmf-dist/source/latex/standalone/README b/Master/texmf-dist/source/latex/standalone/README
index 4d4f01593ac..69e7ee522e5 100644
--- a/Master/texmf-dist/source/latex/standalone/README
+++ b/Master/texmf-dist/source/latex/standalone/README
@@ -1,12 +1,12 @@
LaTeX class and package 'standalone'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Copyright (c) 2010 by Martin Scharrer <martin@scharrer-online.de>
+Copyright (c) 2010-2011 by Martin Scharrer <martin@scharrer-online.de>
WWW: http://latex.scharrer-online.de/standalone/
-Allows TeX pictures or other TeX code in sub-files to be compiled standalone
+Allows TeX pictures or other TeX code in sub-files to be compiled standalone
or as part of a main document.
Provides support for pictures with beamer overlays.
-Since v0.3 the package provides options to automatically or manually include
+Since v0.3 the package provides options to automatically or manually include
all sub-files preambles in the main document preamble.
diff --git a/Master/texmf-dist/source/latex/standalone/gincltex.dtx b/Master/texmf-dist/source/latex/standalone/gincltex.dtx
new file mode 100644
index 00000000000..819f69487f9
--- /dev/null
+++ b/Master/texmf-dist/source/latex/standalone/gincltex.dtx
@@ -0,0 +1,355 @@
+% \iffalse meta-comment
+%
+% Copyright (C) 2009 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 gincltex.dtx, gincltex.ins
+% and the derived file gincltex.sty.
+%
+% $Id: skeleton.dtx 1057 2009-05-04 11:11:37Z martin $
+% \fi
+%
+% \iffalse
+\RequirePackage{svn-prov}
+%<package>\ProvidesPackage{gincltex}
+%<*driver>
+\ProvidesFile{gincltex.dtx}
+%</driver>
+ [2011/01/23 v0.1 Include external LaTeX files like graphics]
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{gincltex}
+\usepackage{hyperref}
+
+\EnableCrossrefs
+%\CodelineIndex
+\RecordChanges
+%\OnlyDescription
+\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}{2011/01/23}{First released version}
+%
+% \GetFileInfo{\jobname.dtx}
+%
+% \DoNotIndex{\newcommand,\newenvironment,\def,\edef,\xdef,\let}
+%
+% \ifpdf
+% \hypersetup{%
+% pdfauthor = {Martin Scharrer <martin@scharrer-online.de>},
+% pdftitle = {The gincltex package},
+% pdfsubject = {Documentation of LaTeX package gincltex},
+% pdfkeywords = {gincltex, include, graphic, source code, LaTeX, TeX}
+% }%
+% \fi
+% \clearpage
+% \null
+% \vspace*{-2em}
+% \begin{center}
+% {\LARGE\sffamily The \emph{gincltex} Package\\[\medskipamount]}
+% {\large\sffamily Part of the \emph{standalone} bundle\\[\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}
+% This small package builds on the standard \LaTeX{} packages |graphic| and |graphicx|
+% and its extended form |graphicx| and allows external \LaTeX{} source files
+% to be included like image files:
+% \begin{quote}
+% |\includegraphics[<options>]{somefile.tex}|
+% \end{quote}
+%
+% Usually such \LaTeX{} files hold a picture environment like
+% |picture|, |pspicture|, |pgfpicture| or |tikzpicture|, which may take advantage
+% from the |standalone| class.
+%
+% All options of |\includegraphics| described in the manual of |graphic|/|graphicx| (the |grfguide|)
+% should be supported. Therefore it is possible to resize, rotate and clip the content
+% of the \LaTeX{} source file in the same way as for images.
+%
+% \section{Usage}
+% After loading the package the |.tex| extension is supported by |\includegraphics|
+% and the macro can be used in its normal form for \LaTeX{} files.
+% The content of the file is typeset first inside an |\hbox| (the primitive version of |\mbox|)
+% and then modified according to the given macro options.
+%
+% \subsection{Draft support}
+% The package supports the |draft| option of |graphics| which only displays an empty box
+% with the file name for all included graphics.
+% In this mode the source file should not be processed to reduce compile time.
+% However the size of the resulting box from the source file must be know in order
+% to reserve the required space. Therefore the \emph{bounding box} information is
+% cached for future runs with active |draft| option. The location where the information
+% is cached can be controlled with the |bb| option.
+%
+% \subsection{Package options}
+% The place where the bounding box information is cached can be adjusted with the
+% |bb| option. By default |bb=aux| is active which stores the bounding box information
+% in the |.aux| file. With |bb=file| this information is written in EPS format into
+% |.tex.bb| files, e.g. for each source file |name.tex| a file |name.tex.bb| is created.
+%
+%
+% \StopEventually{}
+% \iffalse
+%<*package>
+% \fi
+% \section{Implementation}
+% \subsection{Package Option}
+% \begin{macrocode}
+\newif\if@gincltex@bbfile
+\DeclareOption{bb=file}{\@gincltex@bbfiletrue}
+\DeclareOption{bb=aux}{\@gincltex@bbfilefalse}
+\ProcessOptions*\relax
+% \end{macrocode}
+%
+% \subsection{Requirements}
+% The |graphics| or |graphicx| package is required but not loaded to allow
+% the user to decide which one should be used
+% \begin{macrocode}
+\RequirePackage{pgf}
+% \end{macrocode}
+
+% \subsection{Graphics Rule Macros}
+% The following macro implement a \emph{graphics rule} for \LaTeX{} source code files.
+%
+% \begin{macro}{\Gin@rule@.tex}
+% This macro declares the graphics rule to the |graphics|/|x| package.
+% It is equivalent to |\DeclareGraphicsRule{.tex}{tex}{.tex}{}|, which is not
+% used here to not rely on the graphics packages at load time.
+% \begin{macrocode}
+\@namedef{Gin@rule@.tex}#1{{tex}{.tex}{#1}}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\gincltex@box}
+% A savebox required to transfer material from the `read' macro to the `include' macro.
+% Note that |\@tempboxa| is not used here because it might be used otherwise between the
+% two macros.
+% \begin{macrocode}
+\newsavebox\gincltex@box
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\gincltex@input}
+% Macro to input the \LaTeX{} source file.
+% Because |\includegraphics| can be used inside this file certain internal |graphics| macros
+% must be reset to there default value.
+% \begin{macrocode}
+\def\gincltex@input#1{%
+ {\let\Gin@ext\relax\input{#1}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Ginclude@tex}
+% This driver macro is called from the standard |\includegraphics| macro to include the \LaTeX{} source file.
+% Some |\includegraphics| options like |angle| are handled by wrapping this macro in the appropriate
+% |graphics| macro like |\rotatebox|, but others must be handled here.
+% \begin{macrocode}
+\def\Ginclude@tex#1{%
+ \begingroup
+% \end{macrocode}
+% The content of the source file might have been already saved into the |\gincltex@box| by the |\Gread@tex| macro.
+% If not it is saved here.
+% \begin{macrocode}
+ \ifvoid\gincltex@box
+ \sbox\gincltex@box{{\gincltex@input{#1}}}%
+ \fi
+% \end{macrocode}
+% The bounding box points (lower left, upper right) are calculated. It is assumed that the `graphic' baseline starts at the
+% lower left point, so |llx=0|. The depth should be |0| as well but to be on the save side it is calculated here.
+% The upper right point is given by the box width and height.
+% \begin{macrocode}
+ \def\Gin@llx{0}%
+ \Gin@defaultbp\Gin@lly{-\dp\gincltex@box}%
+ \Gin@defaultbp\Gin@urx{\wd\gincltex@box}%
+ \Gin@defaultbp\Gin@ury{\ht\gincltex@box}%
+% \end{macrocode}
+% The |height|, |totalheight| and |width| options are already processed and the final requested height and width
+% to which the `graphic' should be scaled to are provided. The internal form of the |\resizebox| macro is used for
+% this.
+% \begin{macrocode}
+ \Gscale@@box\totalheight{\Gin@req@width}{\Gin@req@height}{%
+% \end{macrocode}
+% The trimming and clipping operations (|trim|, |viewport| and |clip| options) are handled using a |pgfpicture| from
+% the |pgf| package, because it supports both DVI and PDF output.
+% \begin{macrocode}
+ \begin{pgfpicture}%
+ \pgfkeys{/pgf/.cd,inner sep=0pt,outer sep=0pt}%
+ \pgfpathmoveto{\pgfqpoint{\Gin@llx bp}{\Gin@lly bp}}%
+ \pgfpathlineto{\pgfqpoint{\Gin@urx bp}{\Gin@lly bp}}%
+ \pgfpathlineto{\pgfqpoint{\Gin@urx bp}{\Gin@ury bp}}%
+ \pgfpathlineto{\pgfqpoint{\Gin@llx bp}{\Gin@ury bp}}%
+ \pgfpathclose
+ \expandafter\pgfusepath\ifGin@clip{clip}\else{use as bounding box}\fi
+ \pgfnode{rectangle}{base west}{\usebox\gincltex@box}{}{}%
+ \end{pgfpicture}%
+% \end{macrocode}
+% \begin{macrocode}
+ }%
+ \endgroup
+}
+% \end{macrocode}
+% \end{macro}
+%
+% The |\Gread@tex| macro is defined in two different ways depending how the bounding box information is preserved.
+% This information is required to support the |draft| option of the |graphics| package.
+% \begin{macrocode}
+\if@gincltex@bbfile
+% \end{macrocode}
+% Use a |.tex.bb| file to store the bounding box information. The standardised EPS format is used here, so that the
+% |\Gread@eps| macro can be used.
+%
+% An output register is required to write the |.tex.bb| files. Advanced users are allowed to predefine it manually
+% in order to save a write register. Note that the writing is done inside the |.aux| file, therefore the |\@mainaux|
+% handle could be used here, because it is closed while reading the |.aux| file.
+% \begin{macrocode}
+\@ifundefined{gincltex@bbout}{\newwrite\gincltex@bbout}{}
+% \end{macrocode}
+%
+% \begin{macro}{\Gread@tex}
+% \begin{macrocode}
+\def\Gread@tex#1{%
+ \IfFileExists{#1.bb}%
+ {\edef\Gread@BBox{\@percentchar\@percentchar HiResBoundingBox}\Gread@eps{#1.bb}}%
+ {%
+ \sbox\gincltex@box{{\gincltex@input{#1}}}%
+ \def\Gin@llx{0}%
+ \Gin@defaultbp\Gin@lly{-\dp\gincltex@box}%
+ \Gin@defaultbp\Gin@urx{\wd\gincltex@box}%
+ \Gin@defaultbp\Gin@ury{\ht\gincltex@box}%
+ \expandafter\xdef\csname gincltex@bb@#1\endcsname{{\Gin@llx}{\Gin@lly}{\Gin@urx}{\Gin@ury}}%
+ \if@filesw
+ \immediate\write\@auxout{\string\gincltex@bb{#1}\csname gincltex@bb@#1\endcsname}%
+ \fi
+ }%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\gincltex@bb}
+% Write the bounding box information to the |.tex.bb| file. The hi-resolution version is used to be more accurate.
+% The code to write the normal version is disabled for now because it is unneeded and requires some non-trivial |pgfmath| calls.
+%
+% Because this macro is executed inside the |.aux| file, which is read before the begin AND at the end of the document, the macro
+% is defined as a no-op first two avoid unnecessary double execution.
+% \begin{macrocode}
+\def\gincltex@bb#1#2#3#4#5{}
+\AtBeginDocument{\let\gincltex@bb\gincltex@@bb}
+\def\gincltex@@bb#1#2#3#4#5{%
+ \begingroup
+ \immediate\openout\gincltex@bbout=#1.bb\relax
+ %\pgfmathtruncatemacro\llx{ceil(#2)}%
+ %\pgfmathtruncatemacro\lly{ceil(#3)}%
+ %\pgfmathtruncatemacro\urx{ceil(#4)}%
+ %\pgfmathtruncatemacro\ury{ceil(#5)}%
+ %\immediate\write\gincltex@bbout{\@percentchar\@percentchar BoundingBox: \llx\space\lly\space\urx\space\ury}%
+ \immediate\write\gincltex@bbout{\@percentchar\@percentchar HiResBoundingBox: #2 #3 #4 #5}%
+ \immediate\closeout\gincltex@bbout
+ \endgroup
+}
+% \end{macrocode}
+% \end{macro}
+%
+% Storing the bounding box information in the |.aux| file.
+% \begin{macrocode}
+\else
+% \end{macrocode}
+%
+% \begin{macro}{\Gread@tex@setbb}
+% Auxiliary macro to set the bounding box macros.
+% \begin{macrocode}
+\def\Gread@tex@setbb#1#2#3#4{%
+ \def\Gin@llx{#1}%
+ \def\Gin@lly{#2}%
+ \def\Gin@urx{#3}%
+ \def\Gin@ury{#4}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\Gread@tex}
+% Read the bounding box information. The only way to do this is to actually typeset the source file into a box.
+% The box is then reused in the |\Ginclude@tex| macro, so there is no overhead.
+% The bounding box information is written into the |.aux| file to avoid processing the source file in |draft| mode.
+% However if the corresponding macro is not define yet (e.g.\ |draft| run without |.aux| file) the file must be
+% read anyway.
+% \begin{macrocode}
+\def\Gread@tex#1{%
+ \ifcase0\ifGin@draft\@ifundefined{gincltex@bb@#1}{0}{1}\fi\relax
+ \sbox\gincltex@box{{\gincltex@input{#1}}}%
+ \def\Gin@llx{0}%
+ \Gin@defaultbp\Gin@lly{-\dp\gincltex@box}%
+ \Gin@defaultbp\Gin@urx{\wd\gincltex@box}%
+ \Gin@defaultbp\Gin@ury{\ht\gincltex@box}%
+ \expandafter\xdef\csname gincltex@bb@#1\endcsname{{\Gin@llx}{\Gin@lly}{\Gin@urx}{\Gin@ury}}%
+ \else
+ \expandafter\expandafter\expandafter\Gread@tex@setbb\csname gincltex@bb@#1\endcsname
+ \setbox\gincltex@box=\box\voidb@x
+ \fi
+ \if@filesw
+ \immediate\write\@auxout{\string\gincltex@bb{#1}\csname gincltex@bb@#1\endcsname}%
+ \fi
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\gincltex@bb}
+% Simply define the corresponding bounding box macro.
+% \begin{macrocode}
+\def\gincltex@bb#1#2#3#4#5{%
+ \global\@namedef{gincltex@bb@#1}{{#2}{#3}{#4}{#5}}%
+}
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
+\fi
+\endinput
+% \end{macrocode}
+%
+% \Finale
+%</package>
+
diff --git a/Master/texmf-dist/source/latex/standalone/gincltex.ins b/Master/texmf-dist/source/latex/standalone/gincltex.ins
new file mode 100644
index 00000000000..52858c81cc4
--- /dev/null
+++ b/Master/texmf-dist/source/latex/standalone/gincltex.ins
@@ -0,0 +1,49 @@
+%% $Id: skeleton.ins 1041 2009-05-02 16:07:25Z martin $
+\input docstrip.tex
+\preamble
+
+Copyright (C) 2011 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 gincltex.dtx, gincltex.ins
+and the derived file gincltex.sty.
+
+\endpreamble
+\keepsilent
+
+\generate{%
+ \file{gincltex.sty}{\from{gincltex.dtx}{package}}%
+}
+
+\obeyspaces
+\Msg{*************************************************************}
+\Msg{* *}
+\Msg{* To finish the installation you have to move the following *}
+\Msg{* file into a directory searched by TeX: *}
+\Msg{* *}
+\Msg{* gincltex.sty *}
+\Msg{* *}
+\Msg{* To produce the documentation run the file gincltex.dtx *}
+\Msg{* through LaTeX. *}
+\Msg{* *}
+\Msg{* Happy TeXing! *}
+\Msg{* *}
+\Msg{*************************************************************}
+
+\endbatchfile
+
+%% vim: ft=tex
+
diff --git a/Master/texmf-dist/source/latex/standalone/standalone.dtx b/Master/texmf-dist/source/latex/standalone/standalone.dtx
index 17098bdb05d..41496f58f5f 100644
--- a/Master/texmf-dist/source/latex/standalone/standalone.dtx
+++ b/Master/texmf-dist/source/latex/standalone/standalone.dtx
@@ -18,38 +18,34 @@
% 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.
+% and the derived files standalone.cls, standalone.sty, standalone.tex and
+% standalone.cfg.
%
-% $Id: standalone.dtx 1772 2010-03-27 13:50:59Z martin $
+% $Id: standalone.dtx 2194 2011-02-28 19:26:29Z martin $
% \fi
%
% \iffalse
-%<cls|sty|cfg|tex>% $Id: standalone.dtx 1772 2010-03-27 13:50:59Z martin $
+%<cls|sty|cfg|tex>% $Id: standalone.dtx 2194 2011-02-28 19:26:29Z martin $
%<cls|sty>\NeedsTeXFormat{LaTeX2e}
-%<cls>\ProvidesClass{standalone} [2010/03/27 v0.3a Class to compile TeX sub-files standalone]
-%<sty>\ProvidesPackage{standalone} [2010/03/27 v0.3a Package to include TeX sub-files with preambles]
-%<tex>\ProvidesFile{standalone.tex}[2010/03/27 v0.3a Provides if-switch to show if file is compiled standalone]%
-%<cfg>\ProvidesFile{standalone.cfg}[2010/03/27 v0.3a Default configuration file for 'standalone' class]%
+%<cls>\ProvidesClass{standalone} [2010/02/28 v0.4 Class to compile TeX sub-files standalone]
+%<sty>\ProvidesPackage{standalone} [2010/02/28 v0.4 Package to include TeX sub-files with preambles]
+%<tex>\ProvidesFile{standalone.tex}[2010/02/28 v0.4 Provides if-switch to show if file is compiled standalone]%
+%<cfg>\ProvidesFile{standalone.cfg}[2010/02/28 v0.4 Default configuration file for 'standalone' class]%
%<*driver>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesFile{standalone.dtx}[2010/03/27 v0.3a DTX File for 'standalone' cls/sty/tex/cfg files]
-\documentclass{ltxdoc}
+\ProvidesFile{standalone.dtx}[2011/02/28 v0.4 DTX File for 'standalone' cls/sty/tex/cfg files]
+\documentclass{scrartcl}
+\usepackage{ydoc}
\usepackage{ifpdf}
\usepackage{listings}
-\IfFileExists{hypdoc.sty}{%
-\usepackage{hypdoc}
-}{%
\usepackage{hyperref}
-}
-\def\optpar#1{\marginpar{\hfill\opt{#1}}}
-\def\opt#1{{\sffamily#1}}
+\def\optpar#1{\marginpar{\raggedright\opt{#1}}}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
%\OnlyDescription
-\providecommand{\env}[1]{\texttt{#1}}
\begin{document}
\DocInput{\jobname.dtx}
\PrintChanges
@@ -58,7 +54,7 @@
%</driver>
% \fi
%
-% \CheckSum{1111}
+% \CheckSum{1298}
%
% \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
@@ -76,11 +72,11 @@
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
-%
% \changes{v0.1}{2010/03/21}{First released version}
% \changes{v0.2}{2010/03/22}{Added support for beamer style settings in the config file using \cs{ifstandalonebeamer}. Updated documentation.}
% \changes{v0.3}{2010/03/26}{Added package options to automatically copy sub-preamble code to the main preamble.}
% \changes{v0.3a}{2010/03/27}{Fixed bug related to line endings in \texttt{.sta} file. Listed sub-files now have \texttt{.tex} as default extension.}
+% \changes{v0.4}{2011/02/28}{Added option 'border' for easy adjustments of the preview border.}
%
% \GetFileInfo{\jobname.dtx}
%
@@ -111,7 +107,7 @@
% \vspace*{-2em}
% \begin{center}
% {\LARGE\sffamily The \emph{standalone} Class and Package\\[\medskipamount]}
-% {\large Martin Scharrer \\[\medskipamount]\normalsize
+% {\large Martin Scharrer \\[\medskipamount]\normalsize
% \url{martin@scharrer-online.de}\\[.8ex]
% \url{http://www.ctan.org/pkg/standalone/}\\[\bigskipamount]}
% {\large Version \fileversion\ -- \filedate}\\
@@ -120,8 +116,8 @@
%
% \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,
+% 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.
%
@@ -129,13 +125,13 @@
% 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. The main file must load all packages
+% The package |standalone| can be used in the main document to skip all extra preambles in included files. The main file must load all packages
% and settings required by the sub-files. Several package options are provided to collect the preambles of the sub-files automatically and execute them from the main file.
%
% 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 an output file which only contains the picture with no extra
-% margins, page numbers or anything else. A configuration file |standalone.cfg| read by the class allows the user to adjust settings and macros easily
+% margins, page numbers or anything else. A configuration file |standalone.cfg| read by the class allows the user to adjust settings and macros easily
% on a per directory base.
%
% \subsection*{Similar Packages}
@@ -146,22 +142,27 @@
% \subsection{Quick instructions}
% Load the |standalone| \emph{package} very early in the main document. Also all packages needed by all the sub-files must be loaded by the main document.
% Include your picture or other sub-files using |\input| or a similar macro as normal.
-% In the sub-files use the |standalone| \emph{class} with a normal \cs{documentclass} and load all packages needed for the particular
+% In the sub-files use the |standalone| \emph{class} with a normal \cs{documentclass} and load all packages needed for the particular
% file. Finally wrap the actual content of the sub-file 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
+% 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.
%
% Instead of transferring the packages required by each sub-file manually to the main document preamble, this task can be automatised using
% the options listed in section~\ref{sec:pkgoptions}
%
% \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
+% The |standalone| class will load a real document class.\optpar{class} By default this is |article|. The document class normally has not much
+% influence on sub-files like pictures, especially when the \pkg{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.
+% The boolean \opt{preview}\optpar{preview} option can be used to disable the use of the \pkg{review} package. The default is |preview=true|. The package is not loaded if |preview=false| is set.
+% The preview border can be set using the \opt{border}\optpar{border} option. This border will be added to the file content.
+% The usage is either \MacroArgs'border='{<left>~<lower>~<right>~<upper>}, \MacroArgs'border='{<left/right>~<lower/upper>} or \MacroArgs'border='<all sides>.
+% The default unit is |bp| (big points) which is the unit used by the PostScript and PDF formats. If |preview=false| is set this option will be ignored.
+%
+% A special \opt{beamer}\optpar{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.
%
@@ -182,14 +183,14 @@
% If such issues occur they can hardly be handled in an automatic way. Instead the sub-preambles must be carefully merged into the main preamble.
% The option \opt{print}\optpar{print} was created to simplify this otherwise cumbersome task.
% It concatenated all sub-preambles into a single file named `\meta{main tex file name}|.stp|' (for \emph{st}andalone, \emph{p}rint). Each preamble is commented with its original file name.
-% Please note that |.sta| file mentioned above, while quite similar, holds additional macros and might not be easily user readable or editable.
+% Please note that |.sta| file mentioned above, while quite similar, holds additional macros and might not be easily user readable or editable.
% After the file was generated it can be easily pasted into the main file preamble using a text editor.
%
% When the \opt{print} option is enabled the normal |.sta| file is not generated or loaded. Because this will cause most likely some errors related to packages not loaded, all sub-file bodies will be skipped.
% A warning is printed for each sub-file to remind the user about this fact. The \opt{print} option is only indented to by used when required to get a list of sub-preambles. After including this list in the main file the option
% must be removed to compile the main file normally.
%
-% Finally if both the \opt{print} and \opt{sort}\optpar{print, sort} options are enabled, a `sorted' list of sub-preambles is printed into the |.stp| file. In this `sorted print' mode all |\usepackage| macros (and similar macros like
+% Finally if both the \opt{print} and \opt{sort}\optpar{print}\optpar{sort} options are enabled, a `sorted' list of sub-preambles is printed into the |.stp| file. In this `sorted print' mode all |\usepackage| macros (and similar macros like
% |\usepgflibrary|, |\usetikzlibrary| and |\usetikztiminglibrary| from the |pgf|, |tikz| and |tikz-timing| packages, respectively) are removed from the rest of the sub-preamble code.
% A list of packages (and libraries) without duplicates is printed at the begin of the |.stp| file (using |\usepackage|, of course). Every option provided by any sub-file for a package is added, again without duplicates.
% If specific package date was requested in a sub-file it is also added. If multiple dates are requested for one package, the most recent (i.e.\ the ``highest one'', not the last processed) is used.
@@ -201,7 +202,7 @@
% The macro \cs{onlyifstandalone}\marg{code} (see below) was created because of this two reasons. Its argument braces hide the content from the scanner.
% It is then also completely removed from the printed sub-preamble code.
%
-% The complementary options \opt{comments}/\opt{nocomments}\optpar{comments/nocomments} select if the |.stp| file should also include the comments of the sub-preambles.
+% The complementary options \opt{comments}/\opt{nocomments}\optpar{comments}\optpar{nocomments} select if the |.stp| file should also include the comments of the sub-preambles.
% Comments are included by default in the non-sorting print mode (\opt{print} without \opt{sort} option), but can cause `wrong' results during the `sorting' process and are therefore removed by default in this mode.
% The reason for this can be explained as follows.
% In order to transfer the comments from the sub-files to the |.stp| file \TeX\ must be instructed to handle them as normal input and not discard them.
@@ -212,38 +213,47 @@
% \subsection{Dependencies}
% The |standalone| class requires the |kvoptions| package (Oberdiek bundle) and the |preview| package. Both should be available in a standard \LaTeX\ installation.
% The |beamer| option of course requires the |beamer| bundle to be installed.
-% The |standalone| package does not require other packages, but can take advantage from the |fink| package (\emph{Fi}le \emph{N}ame \emph{K}eeper),
+% The |standalone| package does not require other packages, but can take advantage from the |fink| package (\emph{Fi}le \emph{N}ame \emph{K}eeper),
% to access the filenames of the sub-files. For this the |fink| package must be loaded before |standalone|. Without it a file name macro defined by \LaTeX\ itself
% is used instead which should do also fine, but is reset at every |\input| macro. Placing this macro before |\documentclass| without marking
% it with |\csname standaloneignore\endcsname| will then lead to wrong file names inside the |.sta| and |.stp| files.
%
% \subsection{Environments and Macros}
%
-% \DescribeEnv{standalone}
-% The \env{standalone} environment is wrapped around the content of each sub-file when compiled standalone.
+% \DescribeEnv[<sub-file content>]{standalone}
+% The \env{standalone} environment is automatically 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.
+% \begin{DescribeEnv}{standaloneframe}
+% !\color{optional}\colorlet{meta}{metaoptional}!
+% <<overlay specification>>'[<'<default overlay spec>'>]'
+% !\\\hspace*{7em}!
+% !\color{optional}\colorlet{meta}{metaoptional}!
+% [<options>]{<optional frame title>}{<optional frame subtitle>}
+% \relax\MacroArgs<code with beamer overlays>
+% \end{DescribeEnv}
+% The \env{standaloneframe} environment must be used in sub-file holding beamer overlay code.
+% It 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 but most might not be useful for normal sub-files.
% 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
+% 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.
%
% \DescribeMacro{\ifstandalonebeamer}
-% Both the class and the package provide the if-switch \cs{ifstandalonebeamer}, which can be used to only include code if the file is
+% Both the class and the package provide the if-switch \cs{ifstandalonebeamer}, which can be used to only include code if the file is
% compiled standalone with the |beamer| class option set.
% The switch is set to \cs{iftrue} by the class when loaded with the |beamer| option and always to \cs{iffalse} by the package.
%
-% \DescribeMacro{\onlyifstandalone}\hspace*{-\parindent}\hspace*{-\marginparsep}\marg{code}\hspace*{\parindent}
+% \DescribeMacro{\onlyifstandalone}{<code>}
% This is the macro version of the |\ifstandalone| if-switch. It executes \meta{code} only in |standalone| mode. As mentioned in section~\ref{sec:pkgoptions}
% it can also be used to hide |\usepackage| and similar macros from the extraction scanner of the |sort| option. The macro and its argument is not printed into the |.stp| file.
%
@@ -252,7 +262,7 @@
% Because the main document will only skip code between |\documentclass| and |\begin{document}| this code will be executed by it.
% In order to avoid this the macro \cs{standaloneignore} can be used at the very beginning of a sub-file to skip over this code.
% However it must be written as |\csname standaloneignore\endcsname| to avoid a `Undefined control sequence' error when compiled standalone.
-% After all the class is not loaded at this point, therefore no |standalone| macros are yet defined.
+% After all the class is not loaded at this point, therefore no |standalone| macros are yet defined.
% The |\csname|\ldots|\endcsname| construct will simple make it equal to |\relax| in this case.
%
% Please note that all code before |\documentclass| is not processed by any of the \opt{subpreamble} options but always simply removed.
@@ -419,7 +429,7 @@
% \end{minipage}
%
% \subsection{Usage with \texttt{svn-multi} keywords}\label{sec:svnmulti}
-% If the version control package \texttt{svn-multi} is used, the keyword macros (|\svnid| or |\svnidlong|)
+% If the version control package \texttt{svn-multi} is used, the keyword macros (|\svnid| or |\svnidlong|)
% need to be placed after the |\begin{document}| to be taken into account by the main document.
% The \texttt{svn-multi} package must be loaded by the sub-file preamble to avoid compile errors in standalone mode.
% Alternative, if the keywords are not required in this mode, they can be surrounded by |\ifstandalone\else|\dots|\fi|.
@@ -504,6 +514,24 @@
\DeclareOption{nocomments}{%
\def\sa@percent{}%
}
+\DeclareOption{mode=none}{%
+ \let\sa@mode\relax
+}
+\DeclareOption{mode=pdf|tex}{%
+ \def\sa@mode{0}%
+}
+\DeclareOption{mode=tex}{%
+ \def\sa@mode{1}%
+}
+\DeclareOption{mode=pdf}{%
+ \def\sa@mode{2}%
+}
+\DeclareOption{mode=build}{%
+ \def\sa@mode{3}%
+}
+\DeclareOption{mode=buildnew}{%
+ \def\sa@mode{4}%
+}
\ProcessOptions*\relax
% \end{macrocode}
%
@@ -520,7 +548,7 @@
%
% \begin{macro}{\sa@filepath}
% File name macro. If the |fink| package is loaded the macros \cs{finkdir} (with leading `|./|' removed) and \cs{finkpath} is used, otherwise the \LaTeX\ macro
-% \cs{@filef@und} (with trailing space removed and with '.tex' added if it has no file extension).
+% \cs{@filef@und} (with trailing space removed and with '.tex' added if it has no file extension).
% The latter causes issues if |\input| etc. was used before |\documentclass| in sub-files.
% \begin{macrocode}
\@ifundefined{finkpath}{%
@@ -771,44 +799,16 @@
\@ifundefined{sa@pkgdate@\pkg}%
{\global\@namedef{sa@pkgdate@\pkg}{#3}}%
{%
- \begingroup
- \edef\@tempa{{\csname sa@pkgdate@\pkg\endcsname}{#3}}%
- \expandafter\sa@getlargerdate\@tempa
- \expandafter\xdef\csname sa@pkgdate@\pkg\endcsname{\sa@thedate}%
- \endgroup
+ \ifnum\expandafter\expandafter
+ \expandafter\sa@@getdate\csname sa@pkgdate@\pkg\endcsname//00\relax<\sa@@getdate#3//00\relax
+ \global\@namedef{sa@pkgdate@\pkg}{#3}%
+ \fi
}%
\fi
}%
\sa@gobbleeol\sa@removepackages^^J%
}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\sa@getlargerdate}
-% Takes two package dates and returns the larger one as \cs{sa@thedate}.
-% \begin{macrocode}
-\def\sa@getlargerdate#1#2{%
- \sa@@getdate#1\relax\relax0/0/0\relax\empty\relax
- \let\sa@datea\sa@date
- \sa@@getdate#2\relax\relax0/0/0\relax\empty\relax
- \ifdim\sa@datea pt>\sa@date pt
- \def\sa@thedate{#1}%
- \else
- \def\sa@thedate{#2}%
- \fi
-}
-\def\sa@@getdate#1/#2/#3\relax{%
- \@ifnextchar\relax
- {%
- \def\sa@date{#1.#2#3}%
- \sa@@rmdate
- }%
- {%
- \def\sa@date{0}%
- \sa@@rmdate
- }%
-}
-\def\sa@@rmdate#1\empty\relax{}
+\def\sa@@getdate#1/#2/#3#4#5\relax{#1#2#3#4}
% \end{macrocode}
% \end{macro}
%
@@ -955,7 +955,7 @@
% \begin{environment}{standalonepreambles}
% This environment simply adds a group and sets the endline character to a printed newline and the argument character
% |#| as a normal character. The first suppresses |\par|'s in the stored sub-preambles while preserving newlines. The latter
-% is required to permit macro arguments in the preambles. Otherwise a |#| is doubled to |##| causing compile errors when the
+% is required to permit macro arguments in the preambles. Otherwise a |#| is doubled to |##| causing compile errors when the
% sub-preambles are used.
% The |.sta| file is closed after this environment.
% \begin{macrocode}
@@ -973,7 +973,7 @@
%
% \begin{environment}{subpreambles}
% This environment rereads the sub-preambles from the |.sta| files and stores it globally under the name
-% ``\cs{prevsubpreamble@}\meta{file name}''. If sorting is enabled the sub-preambles are also scanned for
+% ``\cs{prevsubpreamble@}\meta{file name}''. If sorting is enabled the sub-preambles are also scanned for
% loaded packages.
% \begin{macrocode}
\long\gdef\subpreamble#1#2\endsubpreamble{%
@@ -1007,7 +1007,7 @@
% \begin{macro}{\AtBeginDocument}
% At begin of the document the |.sta| file is read again. This time the sub-preamble macros are executed as normal.
-% The |standalone| macros are defined to be without effect. If `sorting' is enabled \cs{usepackage} is temporarily
+% The |standalone| macros are defined to be without effect. If `sorting' is enabled \cs{usepackage} is temporarily
% redefined to ignore any given options, which where already passed (\cs{PassOptionsToPackage}) beforehand.
% \begin{macrocode}
\AtBeginDocument{%
@@ -1065,6 +1065,14 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\sa@gobbleline}
+% Gobbles the rest of the input line. This is required when skipping the body of a file to also skip
+% everything on the same line after |\begin{document}|.
+% \begin{macrocode}
+\def\sa@gobbleline#1^^J{}%
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\standaloneignore}
% \changes{v0.3}{2010/03/26}{New macro}
% This macro must only be used in a sub-file before a |\documentclass|. It gobbles everything up to this macro
@@ -1157,9 +1165,10 @@
\def\next{%
\endgroup
\PackageWarning{standalone}{Running 'standalone' package in sub-preamble print mode. All body content of file `\sa@filepath' is ignored!}{}{}%
- \null
+ \hbox to 1pt{\vbox to 1pt{}}%
\endinput
- }
+ %\sa@gobbleline
+ }%
\else
\expandafter
\ifx
@@ -1174,10 +1183,11 @@
\PackageWarning{standalone}{Sub-preamble of file '\sa@filepath' has changed. Content will be ignored. Please rerun LaTeX!}{}{}%
\immediate\write\@mainaux{%
\@percentchar\space standalone package info: Rerun LaTeX!
- }
- \null
+ }%
+ \hbox to 1pt{\vbox to 1pt{}}%
\endinput
- }
+ %\sa@gobbleline
+ }%
\fi
\fi
\else
@@ -1260,7 +1270,7 @@
% \end{macro}
%
% \begin{macro}{\sa@document}
-% This is the |\begin{document}| of the sub files. It does nothing except of
+% This is the |\begin{document}| of the sub files. It does nothing except of
% redefining |\end{document}| and calling our own |atbegindocument| hook.
% \begin{macrocode}
\def\sa@document{%
@@ -1271,7 +1281,7 @@
% \end{macro}
%
% \begin{macro}{\sa@enddocument}
-% This is the |\end{document}| of the sub files. It does nothing except of
+% This is the |\end{document}| of the sub files. It does nothing except of
% calling our own |atenddocument| hook and then the `after end document' handler.
% \begin{macrocode}
\def\sa@enddocument{%
@@ -1282,7 +1292,7 @@
% \end{macro}
%
% \begin{macro}{\sa@@enddocument}
-% This is a `after end document' handler for the sub-files. It restores macros and
+% This is a `after end document' handler for the sub-files. It restores macros and
% ends the input of the file.
% \begin{macrocode}
\def\sa@@enddocument{%
@@ -1356,12 +1366,18 @@
\SetupKeyvalOptions{prefix=sa@}
% \end{macrocode}
%
-% Use of |preview| package is optional but enabled by default.
+% Use of |preview| package is optional but enabled by default.
% This defines the |\ifsa@preview| switch.
% \begin{macrocode}
\DeclareBoolOption[true]{preview}
% \end{macrocode}
%
+% To set the preview border:
+% \begin{macrocode}
+\DeclareStringOption{border}
+\let\sa@border\relax
+% \end{macrocode}
+%
% Enable beamer support.
% \begin{macrocode}
\DeclareVoidOption{beamer}{%
@@ -1424,6 +1440,27 @@
{\endpreview}
}{}%
\RequirePackage{preview}
+% \end{macrocode}
+% Read the preview border values. The default unit is |bp| (PostScript points).
+% Allowed are one, two or four values.
+% \begin{macrocode}
+ \ifx\sa@border\relax\else
+ \begingroup
+ \def\rem@bp#1bp\relax#2\@nnil{#1}%
+ \def\default@bp#1{\expandafter\rem@bp\the\dimexpr#1 bp\relax bp\relax\@nnil}%
+ \def\sa@readborder#1 #2 #3 #4 {%
+ \ifx\\#2#3#4\\%
+ \@defaultunits\global\PreviewBorder=\dimexpr#1 bp\relax\@nnil%
+ \else
+ \ifx\\#4\\%
+ \xdef\PreviewBbAdjust{-\default@bp{#1} -\default@bp{#2} \default@bp{#1} \default@bp{#2}}%
+ \else
+ \xdef\PreviewBbAdjust{-\default@bp{#1} -\default@bp{#2} \default@bp{#3} \default@bp{#4}}%
+ \fi\fi
+ }%
+ \@firstofone{\expandafter\sa@readborder\sa@border} {} {} {} {} \relax
+ \endgroup
+ \fi
\fi
% \end{macrocode}
%
@@ -1535,12 +1572,134 @@
%</tex>
% \fi
%
+% \iffalse
+%<*sty>
+% \fi
+% \begin{macrocode}
+\expandafter\ifx\csname sa@mode\endcsname\relax\else
+% \end{macrocode}
+% \begin{macro}{\includestandalone}
+% \begin{macrocode}
+\RequirePackage{gincltex}
+\RequirePackage{ifpdf}
+\ifpdf
+ \def\sa@graphicext{.pdf}
+\else
+ \def\sa@graphicext{.eps}
+\fi
+
+\def\sa@comparegranpic#1{%
+ \begingroup
+ \let\next\empty
+ \expandafter\sa@comparegranpic@\pdffilemoddate{#1\sa@graphicext}\relax
+ \let\sa@picdate\sa@date
+ \let\sa@pictime\sa@time
+ \expandafter\sa@comparegranpic@\pdffilemoddate{#1.tex}\relax
+ \ifnum\sa@date>\sa@picdate\relax
+ \def\next{\sa@buildgraphic{#1}}%
+ \else
+ \ifnum\sa@date=\sa@picdate\relax
+ \ifnum\sa@time>\sa@pictime\relax
+ \def\next{\sa@buildgraphic{#1}}%
+ \fi
+ \fi
+ \fi
+ \expandafter
+ \endgroup
+ \next
+}
+
+\begingroup
+\@makeother\D
+\@makeother:
+\global\@namedef{sa@comparegranpic@}D:#1#2#3#4#5#6#7#8#9\relax{%
+ \def\sa@date{#1#2#3#4#5#6#7#8}%
+ \sa@comparegranpic@@#9\relax
+}
+\endgroup
+
+\def\sa@comparegranpic@@#1#2#3#4#5#6#7\relax{%
+ \def\sa@time{#1#2#3#4#5#6}%
+ \def\sa@tz{#7}%
+}
+
+\def\sa@compilecmd{\ifpdf pdf\fi latex --interaction=batchmode \image}%
+
+\def\sa@buildgraphic#1{%
+ \ifeof18
+ \PackageError{standalone}{Shell escape needed to create graphic!}{}%
+ \else
+ \begingroup
+ \def\image{#1}%
+ \immediate\write18{\sa@compilecmd}%
+ \endgroup
+ \fi
+}
+
+\newcommand*\includestandalone[2][]{%
+ \begingroup
+ \edef\@tempa{{#2\sa@graphicext}}%
+ \expandafter\includestandalone@\@tempa{#2}{#1}%
+ \endgroup
+}
+
+%% 0 = PDF if exists, TEX otherwise
+%% 1 = force TEX
+%% 2 = force PDF
+%% 3 = build PDF if not exists
+%% 4 = build PDF if older than TEX
+\def\includestandalone@#1#2#3{%
+ \ifcase\sa@mode
+ \relax% 0
+ \IfFileExists{#1}%
+ {\includegraphics[#3]{#1}}%
+ {\includegraphics[#3]{#2.tex}}%
+ \or% 1
+ \includegraphics[#3]{#2.tex}%
+ \or% 2
+ \includegraphics[#3]{#1}%
+ \or% 3
+ \IfFileExists{#1}%
+ {\includegraphics[#3]{#1}}%
+ {\sa@buildgraphic{#2}%
+ \IfFileExists{#1}%
+ {\includegraphics[#3]{#1}}%
+ {\PackageWarning{standalone}%
+ {Graphic '#1' could not be build.^^J%
+ Shell escape activated?}%
+ \includegraphics[#3]{#2.tex}%
+ }%
+ }%
+ \else% 4
+ \IfFileExists{#1}%
+ {\sa@comparegranpic{#2}}%
+ {\sa@buildgraphic{#2}%
+ \IfFileExists{#1}%
+ {\includegraphics[#3]{#1}}%
+ {\PackageWarning{standalone}%
+ {Graphic '#1' could not be build.^^J%
+ Shell escape activated?}%
+ \includegraphics[#3]{#2.tex}%
+ }%
+ }%
+ \fi
+}
+% \end{macrocode}
+%
+% \end{macro}
+% \begin{macrocode}
+\fi
+% \end{macrocode}
+% \iffalse
+%</sty>
+% \fi
+%
% \subsection{Config File}
% Default content of the configuration file. Users can override this by placing an own
% |standalone.cfg| file somewhere where \TeX\ can find it (user |texmf| directory or local directory).
-% This user file can load the default config file using
+% This user file can load the default config file using
% using |\InputIfFileExists{standalone/standalone.cfg}{}{}|.
-% Be default only the |preview| package option are set and
+% Be default only the |preview| package option are set and
% the navigation symbols of beamer standalones are disabled.
% \iffalse
%<*cfg>
diff --git a/Master/texmf-dist/source/latex/standalone/standalone.ins b/Master/texmf-dist/source/latex/standalone/standalone.ins
index 0900fcf2901..8966a2849ef 100644
--- a/Master/texmf-dist/source/latex/standalone/standalone.ins
+++ b/Master/texmf-dist/source/latex/standalone/standalone.ins
@@ -1,4 +1,4 @@
-%% $Id: standalone.ins 1690 2010-03-20 13:52:08Z martin $
+%% $Id: standalone.ins 2051 2011-01-24 11:42:42Z martin $
\input docstrip.tex
\preamble