summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-12-21 23:41:34 +0000
committerKarl Berry <karl@freefriends.org>2011-12-21 23:41:34 +0000
commit34adb1fdc882b4cbadf33ef1f919c673c42aae30 (patch)
treee962d7d9394ebedfd28cda6e0a5127097efcf2b4 /Master/texmf-dist/tex/latex
parentcaa391301c323d8e1ac20ad46d581f1223a09291 (diff)
standalone (21dec11)
git-svn-id: svn://tug.org/texlive/trunk@24894 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r--Master/texmf-dist/tex/latex/standalone/standalone.cfg32
-rw-r--r--Master/texmf-dist/tex/latex/standalone/standalone.cls802
-rw-r--r--Master/texmf-dist/tex/latex/standalone/standalone.sty776
-rw-r--r--Master/texmf-dist/tex/latex/standalone/standalone.tex9
4 files changed, 1410 insertions, 209 deletions
diff --git a/Master/texmf-dist/tex/latex/standalone/standalone.cfg b/Master/texmf-dist/tex/latex/standalone/standalone.cfg
index e96a300647e..b3a92272e58 100644
--- a/Master/texmf-dist/tex/latex/standalone/standalone.cfg
+++ b/Master/texmf-dist/tex/latex/standalone/standalone.cfg
@@ -1,8 +1,34 @@
-% $Id: standalone.dtx 2451 2011-04-07 11:40:38Z martin $
-\ProvidesFile{standalone.cfg}[2011/04/07 v0.4a Default configuration file for 'standalone' class]%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesFile{standalone.cfg}[%
+ 2011/12/21
+ v1.0
+ Default configuration file for 'standalone' class]%
+%% Enabled the "varwidth" option if the "varwidth" package is available:
+%%\IfFileExists{varwidth.sty}{%
+%% \standaloneconfig{varwidth}%
+%%}{}%
+
+%% Default options:
+\standaloneconfig{crop}
+
+%% Option which 'preview' should be loaded with
\PassOptionsToPackage{active,tightpage}{preview}%
+%% Enable 'preview' option by default:
+%%\standaloneconfig{preview}
+
+%% Remove the border:
+\standaloneconfig{border=0pt}
+
+%% Default preview border (used by standalone v0.x):
+%%\standaloneconfig{border=0.50001bp}
+
+%% Disable navigation symbols in beamer.
+%% This must be done AtEndOfClass because the options are not processed yet,
+%% so "beamer" mode is not enabled yet.
+\AtEndOfClass{%
\ifstandalonebeamer
\setbeamertemplate{navigation symbols}{}%
\fi
-% vim: ft=tex
+}
+%% vim: ft=tex
diff --git a/Master/texmf-dist/tex/latex/standalone/standalone.cls b/Master/texmf-dist/tex/latex/standalone/standalone.cls
index 363cd18ce0e..0fd148c0079 100644
--- a/Master/texmf-dist/tex/latex/standalone/standalone.cls
+++ b/Master/texmf-dist/tex/latex/standalone/standalone.cls
@@ -1,87 +1,642 @@
-%%
-%% This is file `standalone.cls',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% standalone.dtx (with options: `cls')
-%%
-%% Copyright (c) 2010 by Martin Scharrer <martin@scharrer-online.de>
-%%
+%% 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
+%% conditions of the LaTeX Project Public License, either version 1.3
%% 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.
-%%
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 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 2451 2011-04-07 11:40:38Z martin $
+%%
+%% This work consists of the files <+name+>.dtx and <+name+>.ins
+%% and the derived filebase <+name+>.sty.
+%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesClass{standalone} [2011/04/07 v0.4a Class to compile TeX sub-files standalone]
+\ProvidesClass{standalone}[%
+ 2011/12/21
+ v1.0
+ Class to compile TeX sub-files standalone]
\newif\ifstandalone
\standalonetrue
\newif\ifstandalonebeamer
\standalonebeamerfalse
\let\onlyifstandalone\@firstofone
-\RequirePackage{kvoptions}
-\SetupKeyvalOptions{prefix=sa@}
-\DeclareBoolOption[true]{preview}
-\DeclareStringOption{border}
-\let\sa@border\relax
-\DeclareVoidOption{beamer}{%
- \def\sa@class{beamer}%
- \sa@previewfalse
- \standalonebeamertrue
-}
-\DeclareStringOption[article]{class}
-\def\sa@classoptionslist{}
-\DeclareDefaultOption{%
- \xdef\sa@classoptionslist{\sa@classoptionslist,\CurrentOption}%
-}
-\ProcessKeyvalOptions*\relax
-\let\@classoptionslist\sa@classoptionslist
+\let\IfStandalone\@firstoftwo
+\def\sa@border@left{0.50001bp}
+\let\sa@border@right\sa@border@left
+\let\sa@border@top\sa@border@left
+\let\sa@border@bottom\sa@border@left
+\def\rem@bp#1bp\relax#2\@nnil{#1}%
+\def\default@bp#1#2{%
+ \begingroup
+ \afterassignment\remove@to@nnil
+ \dimen@ #2bp\relax\@nnil
+ \expandafter
+ \endgroup
+ \expandafter
+ \def\expandafter#1\expandafter{\the\dimen@}%
+}
+\def\sa@readborder#1 #2 #3 #4 #5\@nnil{%
+ \ifx\\#2#3#4\\%
+ \default@bp\sa@border@left{#1}%
+ \let\sa@border@right\sa@border@left
+ \let\sa@border@top\sa@border@left
+ \let\sa@border@bottom\sa@border@left
+ \else
+ \ifx\\#4\\%
+ \default@bp\sa@border@left{#1}%
+ \let\sa@border@right\sa@border@left
+ \default@bp\sa@border@top{#2}%
+ \let\sa@border@bottom\sa@border@top
+ \else
+ \default@bp\sa@border@left{#1}%
+ \default@bp\sa@border@bottom{#2}%
+ \default@bp\sa@border@right{#3}%
+ \default@bp\sa@border@top{#4}%
+ \fi\fi
+}%
+\expandafter\ifx\csname ifluatex\endcsname\relax
+ \IfFileExists{ifluatex.sty}{\@firstoftwo}{\@secondoftwo}{%
+ \RequirePackage{ifluatex}
+ }{
+ \begingroup
+ \expandafter\ifx\csname directlua\endcsname\relax
+ \endgroup
+ \expandafter\let\csname ifluatex\expandafter\endcsname\csname iffalse\endcsname
+ \else
+ \endgroup
+ \expandafter\let\csname ifluatex\expandafter\endcsname\csname iftrue\endcsname
+ \fi
+ }
+\fi
+\expandafter\ifx\csname ifpdf\endcsname\relax
+ \IfFileExists{ifpdf.sty}{\@firstoftwo}{\@secondoftwo}{%
+ \RequirePackage{ifpdf}
+ }{
+ \begingroup
+ \expandafter\ifx\csname pdfoutput\endcsname\relax
+ \endgroup
+ \expandafter\let\csname ifpdf\expandafter\endcsname\csname iffalse\endcsname
+ \else
+ \endgroup
+ \ifnum\pdfoutput<1
+ \expandafter\let\csname ifpdf\expandafter\endcsname\csname iffalse\endcsname
+ \else
+ \expandafter\let\csname ifpdf\expandafter\endcsname\csname iftrue\endcsname
+ \fi
+ \fi
+ }
+\fi
+\expandafter\ifx\csname ifxetex\endcsname\relax
+ \IfFileExists{ifxetex.sty}{\@firstoftwo}{\@secondoftwo}{%
+ \RequirePackage{ifxetex}
+ }{
+ \begingroup
+ \expandafter\ifx\csname XeTeXrevision\endcsname\relax
+ \endgroup
+ \expandafter\let\csname ifxetex\expandafter\endcsname\csname iffalse\endcsname
+ \else
+ \endgroup
+ \expandafter\let\csname ifxetex\expandafter\endcsname\csname iftrue\endcsname
+ \fi
+ }
+\fi
+\let\sa@classoptionslist\@classoptionslist
+\RequirePackage{xkeyval}
+\newif\ifsa@preview
+\newif\ifsa@crop
+\newif\ifsa@multi
+\newif\ifsa@varwidth
+\newif\ifsa@ignorerest
+\newif\ifsa@tikz
+\newif\ifsa@pstricks
+\newif\ifsa@convert
+\newif\ifsa@float
+\let\sa@beamertrue\standalonebeamertrue
+\let\sa@beamerfalse\standalonebeamerfalse
+\def\sa@clsoption{%
+ \define@key{standalone.cls}%
+}
+\sa@clsoption{border}{%
+ \sa@readborder#1 {} {} {} {} \@nnil
+}
+\def\sa@boolean#1#2{%
+ \sa@boolorvalue{#1}{#2}%
+ {\ClassError{standalone}{Invalid value '#2' for boolean key '#1'}{}}%
+}
+\def\sa@boolorvalue#1#2{%
+ \begingroup
+ \edef\@tempa{#2}%
+ \def\@tempb{true}%
+ \ifx\@tempa\@tempb
+ \endgroup
+ \csname sa@#1true\endcsname
+ \expandafter\@gobble
+ \else
+ \def\@tempb{false}%
+ \ifx\@tempa\@tempb
+ \endgroup
+ \csname sa@#1false\endcsname
+ \expandafter\expandafter
+ \expandafter\@gobble
+ \else
+ \endgroup
+ \expandafter\expandafter
+ \expandafter\@firstofone
+ \fi\fi
+}
+\sa@clsoption{preview}[true]{%
+ \sa@boolean{preview}{#1}%
+ \ifsa@preview
+ \setkeys{standalone.cls}{crop=false,float=false}%
+ \fi
+}
+\sa@previewtrue
+\sa@clsoption{crop}[true]{%
+ \sa@boolean{crop}{#1}%
+ \ifsa@crop
+ \setkeys{standalone.cls}{preview=false,float=false}%
+ \fi
+}
+\sa@clsoption{ignorerest}[true]{%
+ \sa@boolean{ignorerest}{#1}%
+}
+\sa@clsoption{multi}[true]{%
+ \sa@boolorvalue{multi}{#1}{\sa@multitrue\AtBeginDocument{\standaloneenv{#1}}}%
+}
+\sa@clsoption{varwidth}[true]{%
+ \sa@boolorvalue{varwidth}{#1}{\sa@varwidthtrue\def\sa@width{#1}}%
+ \ifsa@varwidth
+ \def\sa@varwidth{\varwidth{\sa@width}}%
+ \def\sa@endvarwidth{\endvarwidth}%
+ \else
+ \let\sa@varwidth\@empty
+ \let\sa@endvarwidth\@empty
+ \fi
+}
+\let\sa@varwidth\@empty
+\let\sa@endvarwidth\@empty
+\sa@clsoption{tikz}[true]{%
+ \sa@boolean{tikz}{#1}%
+ \ifsa@tikz
+ \setkeys{standalone.cls}{multi=tikzpicture,varwidth=false}%
+ \fi
+}
+\sa@clsoption{pstricks}[true]{%
+ \sa@boolean{pstricks}{#1}%
+ \ifsa@pstricks
+ \setkeys{standalone.cls}{multi=pspicture,varwidth=false}%
+ \fi
+}
+\sa@clsoption{beamer}[true]{%
+ \sa@boolean{beamer}{#1}%
+ \ifstandalonebeamer
+ \def\sa@class{beamer}%
+ \setkeys{standalone.cls}{preview=false,crop=false,varwidth=false}%
+ \else
+ \begingroup
+ \def\@tempa{beamer}%
+ \ifx\@tempa\sa@class
+ \endgroup
+ \def\sa@class{article}%
+ \else
+ \endgroup
+ \fi
+ \fi
+}
+\sa@clsoption{class}{%
+ \def\sa@class{#1}%
+}
+\def\sa@class{article}
+\sa@clsoption{float}[true]{%
+ \sa@boolean{float}{#1}%
+ \ifsa@float
+ \let\@float\sa@origfloat
+ \let\end@float\sa@origendfloat
+ \else
+ \ifx\@float\sa@nofloat\else
+ \let\sa@origfloat\@float
+ \fi
+ \ifx\end@float\sa@endnofloat\else
+ \let\sa@origendfloat\end@float
+ \fi
+ \let\@float\sa@nofloat
+ \let\end@float\sa@endnofloat
+ \fi
+}
+\def\sa@nofloat#1{%
+ \def\@captype{#1}%
+ \trivlist\item[]%
+ \@ifnextchar[{%
+ \begingroup
+ \def\@tempa[####1]{%
+ \endgroup
+ }\@tempa
+ }{}%
+}
+\def\sa@endnofloat{%
+ \endtrivlist
+}
+\sa@clsoption{convert}[true]{%
+ \setkeys{standalone.cls/convert}{#1}%
+}
+\sa@clsoption{disable@convert}[]{%
+ \typeout{Disable conversion}
+ \sa@convertfalse
+ \let\sa@converttrue\relax
+}
+\def\sa@convertoption{%
+ \define@key{standalone.cls/convert}%
+}
+\def\sa@convertvar#1#2{%
+ \define@key{standalone.cls/convert}{#1}{%
+ \@namedef{sa@convert@#1}{##1}%
+ }%
+ \@namedef{sa@convert@#1}{#2}%
+}
+\sa@convertoption{true}[]{%
+ \sa@converttrue
+}
+\sa@convertoption{false}[]{%
+ \sa@convertfalse
+}
+\sa@convertoption{png}[]{%
+ \setkeys{standalone.cls/convert}{true,outext={.png}}%
+}
+\sa@clsoption{png}[]{%
+ \setkeys{standalone.cls/convert}{png,#1}%
+}
+\sa@convertoption{jpg}[]{%
+ \setkeys{standalone.cls/convert}{true,outext={.jpg}}%
+}
+\sa@clsoption{jpg}[]{%
+ \setkeys{standalone.cls/convert}{jpg,#1}%
+}
+\sa@convertoption{gif}[]{%
+ \setkeys{standalone.cls/convert}{true,outext={.gif}}%
+}
+\sa@clsoption{gif}[]{%
+ \setkeys{standalone.cls/convert}{gif,#1}%
+}
+\sa@convertoption{onfailure}{%
+ \begingroup
+ \edef\@tempa{#1}%
+ \def\@tempb{error}%
+ \ifx\@tempa\@tempb
+ \endgroup
+ \let\sa@convert@failuremsg\ClassError
+ \else
+ \def\@tempb{warning}%
+ \ifx\@tempa\@tempb
+ \endgroup
+ \let\sa@convert@failuremsg\ClassWarning
+ \else
+ \def\@tempb{info}%
+ \ifx\@tempa\@tempb
+ \endgroup
+ \let\sa@convert@failuremsg\ClassInfo
+ \else
+ \def\@tempb{ignore}%
+ \ifx\@tempa\@tempb
+ \endgroup
+ \def\sa@convert@failuremsg##1##2##3{}%
+ \let\sa@convert@notfoundmsg\@gobbletwo
+ \else
+ \let\on@line\@empty
+ \ClassError{standalone}{Invalid value '\@tempa' for the 'onfailure' option.\MessageBreak
+ Valid values: 'error', 'warning', 'info', 'ignore'}{}%
+ \endgroup
+ \fi\fi\fi\fi
+}
+\let\sa@convert@failuremsg\ClassWarning
+\let\sa@convert@notfoundmsg\ClassWarning
+\sa@convertoption{defgsdevice}{%
+ \sa@defgsdevice#1\relax\relax
+}
+\def\sa@defgsdevice#1#2{%
+ \@namedef{sa@gsdevice@#1}{#2}%
+}
+\@namedef{sa@gsdevice@.jpg}{jpeg}%
+\@namedef{sa@gsdevice@.png}{png16m}%
+\sa@convertoption{imagemagick}[]{%
+ \def\sa@convert@command{\convertexe\space -density \density\space \infile\space \ifx\size\empty\else -resize \size\fi\space -quality 90 \outfile}%
+}
+\sa@convertoption{ghostscript}[]{%
+ \def\sa@convert@command{\gsexe\space -dSAFER -dBATCH -dNOPAUSE -sDEVICE=\gsdevice\space -r\density\space -sOutputFile=\outfile\space \infile}%
+}
+\sa@convertvar{subjobname}{\jobname}
+\sa@convertvar{size}{}
+\sa@convertvar{inname}{\subjobname}
+\sa@convertvar{infile}{\inname\inext}
+\sa@convertvar{outext}{.png}
+\sa@convertvar{outname}{\inname}
+\sa@convertvar{outfile}{\outname\ifsa@multi-\@percentchar d\fi\outext}
+\sa@convertvar{density}{300}
+\sa@convertvar{gsdevice}{%
+ \expandafter\ifx\csname sa@gsdevice@\outext\endcsname\relax
+ \expandafter\@gobble\outext
+ \else
+ \csname sa@gsdevice@\outext\endcsname
+ \fi
+}
+\ifluatex
+ \sa@convertvar{latex}{lualatex}
+ \sa@convertvar{inext}{.pdf}
+ \sa@convertvar{precommand}{}
+ \setkeys{standalone.cls/convert}{imagemagick}
+\else
+\ifpdf
+ \sa@convertvar{latex}{pdflatex}
+ \sa@convertvar{inext}{.pdf}
+ \sa@convertvar{precommand}{}
+ \setkeys{standalone.cls/convert}{imagemagick}
+\else
+\ifxetex
+ \sa@convertvar{latex}{xelatex}
+ \sa@convertvar{inext}{.pdf}
+ \sa@convertvar{precommand}{}
+ \setkeys{standalone.cls/convert}{imagemagick}
+\else
+ \sa@convertvar{latex}{latex}
+ \sa@convertvar{inext}{.ps}
+ \sa@convertvar{precommand}{dvips \jobname.dvi}
+ \setkeys{standalone.cls/convert}{ghostscript}
+\fi\fi\fi
\begingroup
-\xdef\@tempa{[\sa@classoptionslist]{\sa@class}}
-\expandafter
-\endgroup
-\expandafter\LoadClass\@tempa
+\ifluatex
+ \csname @tempswa\directlua{
+ if os.type == "windows" then
+ tex.sprint("true")
+ else
+ tex.sprint("false")
+ end
+ }\endcsname
+\else
+ \IfFileExists{/dev/null}{\@tempswafalse}{\@tempswatrue}%
+\fi
+\if@tempswa
+ \endgroup
+ \sa@convertvar{convertexe}{imgconvert}
+ \sa@convertvar{gsexe}{gswin32c}
+\else
+ \endgroup
+ \sa@convertvar{convertexe}{convert}
+ \sa@convertvar{gsexe}{gs}
+\fi
+\newcommand*\standaloneenv[1]{%
+ \begingroup
+ \edef\@tempa{\endgroup\noexpand\@for\noexpand\@tempa:=\zap@space#1 \@empty}%
+ \@tempa\do{\expandafter\@standaloneenv\expandafter{\@tempa}}%
+ \setkeys{standalone.cls}{multi}%
+}
+\@onlypreamble\standaloneenv
+\newcommand*{\standaloneconfig}{\setkeys{standalone.cls}}
+\let\@standaloneenv\@gobble
+\newcount\sa@internal
\let\standalone\empty
\let\endstandalone\relax
-\input{standalone.cfg}
+\def\sa@width{\linewidth}
+\InputIfFileExists{standalone.cfg}{}{}
+\begingroup
+\def\@tempa{\endgroup\setkeys*{standalone.cls}}
+\expandafter\expandafter\expandafter\@tempa
+\expandafter\expandafter\expandafter{\csname opt@standalone.cls\endcsname}
+\let\@classoptionslist\XKV@rm
+\disable@keys{standalone.cls}{crop,preview,class,beamer,ignorerest}
+\AtBeginDocument{%
+ \disable@keys{standalone.cls}{multi}%
+}
+\expandafter\expandafter\expandafter\LoadClass
+\expandafter\expandafter\expandafter[%
+\expandafter\@classoptionslist
+\expandafter]\expandafter{\sa@class}
+\ifsa@varwidth
+ \RequirePackage{varwidth}
+\fi
+\ifsa@tikz
+ \RequirePackage{tikz}
+\fi
+\ifsa@pstricks
+ \RequirePackage{pstricks}
+\fi
\ifsa@preview
- \@ifundefined{endstandalone}{%
- \renewenvironment{standalone}
- {\preview }
- {\endpreview}
- }{}%
- \RequirePackage{preview}
- \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
+\RequirePackage{preview}
+\ifsa@multi\else
+ \@ifundefined{endstandalone}{%
+ \renewenvironment{standalone}
+ {\preview\sa@varwidth}
+ {\sa@endvarwidth\endpreview}
+ }{}% TODO: Add info message?
+\fi
+\def\PreviewBbAdjust{-\sa@border@left\space -\sa@border@bottom\space \sa@border@right\space \sa@border@top}%
+\def\@standaloneenv#1{%
+ \expandafter\ifx\csname sa@orig@#1\endcsname\relax
+ \expandafter\let\csname sa@orig@#1\expandafter\endcsname\csname #1\endcsname
+ \expandafter\let\csname sa@orig@end#1\expandafter\endcsname\csname end#1\endcsname
+ \fi
+ \expandafter\def\csname #1\endcsname{%
+ \ifnum\sa@internal=0
+ \preview
+ \sa@varwidth
+ \fi
+ \advance\sa@internal\@ne
+ \csname sa@orig@#1\endcsname
}%
- \@firstofone{\expandafter\sa@readborder\sa@border} {} {} {} {} \relax
- \endgroup
- \fi
+ \expandafter\def\csname end#1\endcsname{%
+ \csname sa@orig@end#1\endcsname
+ \advance\sa@internal\m@ne
+ \ifnum\sa@internal=0
+ \sa@endvarwidth
+ \endpreview
+ \fi
+ }%
+}%
+\fi
+\ifsa@crop
+\newbox\sa@box
+\pagestyle{empty}
+\hoffset=-72.27pt
+\voffset=-72.27pt
+\topmargin=0pt
+\headheight=0pt
+\headsep=0pt
+\marginparsep=0pt
+\marginparwidth=0pt
+\footskip=0pt
+\marginparpush=0pt
+\oddsidemargin=0pt
+\evensidemargin=0pt
+\topskip=0pt
+\textheight=\maxdimen
+\def\sa@boxit{%
+ \setbox\sa@box\hbox\bgroup\color@setgroup\sa@varwidth
+}%
+\def\endsa@boxit{%
+ \sa@endvarwidth\color@endgroup\egroup
+}%
+\renewenvironment{standalone}{%
+ \ifsa@multi
+ \ifsa@ignorerest
+ \sa@boxit
+ \fi
+ \else
+ \sa@boxit
+ \fi
+}{%
+ \ifsa@multi
+ \ifsa@ignorerest
+ \endsa@boxit
+ \fi
+ \else
+ \endsa@boxit
+ \sa@handlebox
+ \fi
+}
+\ifsa@multi\else
+ \sa@ignorerestfalse
+\fi
+\ifsa@ignorerest
+ \def\@standaloneenv#1{%
+ \expandafter\ifx\csname sa@orig@#1\endcsname\relax
+ \expandafter\let\csname sa@orig@#1\expandafter\endcsname\csname #1\endcsname
+ \expandafter\let\csname sa@orig@end#1\expandafter\endcsname\csname end#1\endcsname
+ \fi
+ \expandafter\def\csname #1\endcsname{%
+ \ifnum\sa@internal=0
+ \edef\@tempa{\endgroup
+ \noexpand\endsa@boxit
+ \begingroup
+ \def\noexpand\@currenvir{\@currenvir}%
+ \def\noexpand\@currenvline{\@currenvline}%
+ }%
+ \@tempa
+ \sa@boxit
+ \fi
+ \advance\sa@internal\@ne
+ \csname sa@orig@#1\endcsname
+ }%
+ \expandafter\def\csname end#1\endcsname{%
+ \csname sa@orig@end#1\endcsname
+ \advance\sa@internal\m@ne
+ \ifnum\sa@internal=0
+ \endsa@boxit
+ \sa@handlebox
+ \aftergroup\sa@boxit
+ \fi
+ }%
+ }%
+\else
+ \def\@standaloneenv#1{%
+ \expandafter\ifx\csname sa@orig@#1\endcsname\relax
+ \expandafter\let\csname sa@orig@#1\expandafter\endcsname\csname #1\endcsname
+ \expandafter\let\csname sa@orig@end#1\expandafter\endcsname\csname end#1\endcsname
+ \fi
+ \expandafter\def\csname #1\endcsname{%
+ \ifnum\sa@internal=0
+ \sa@boxit
+ \fi
+ \advance\sa@internal\@ne
+ \csname sa@orig@#1\endcsname
+ }%
+ \expandafter\def\csname end#1\endcsname{%
+ \csname sa@orig@end#1\endcsname
+ \advance\sa@internal\m@ne
+ \ifnum\sa@internal=0
+ \endsa@boxit
+ \sa@handlebox
+ \fi
+ }%
+ }%
+\fi
+\def\sa@handlebox{%
+ \sbox\sa@box{%
+ \hskip\sa@border@left
+ \@tempdima=\ht\sa@box
+ \advance\@tempdima\sa@border@top\relax
+ \ht\sa@box=\@tempdima
+ \@tempdima=\dp\sa@box
+ \advance\@tempdima\sa@border@bottom\relax
+ \dp\sa@box=\@tempdima
+ \raise\dp\sa@box
+ \box\sa@box
+ \hskip\sa@border@right
+ }%
+ \sa@placebox
+}
+\ifcase0%
+ \ifpdf\else\ifluatex\else\ifxetex\else 1\fi\fi\fi
+ \relax
+ \def\sa@placebox{%
+ \newpage
+ \global\pdfpagewidth=\wd\sa@box
+ \global\pdfpageheight=\ht\sa@box
+ \global\paperwidth=\wd\sa@box
+ \global\paperheight=\ht\sa@box
+ \global\hsize=\wd\sa@box
+ \global\vsize=\ht\sa@box
+ \global\@colht=\ht\sa@box
+ \global\@colroom=\ht\sa@box
+ \noindent\usebox\sa@box
+ \newpage
+ }
+ \else
+ \def\sa@placebox{%
+ \global\paperwidth=\wd\sa@box
+ \global\paperheight=\ht\sa@box
+ \global\@colht=\maxdimen
+ \global\@colroom=\maxdimen
+ \global\hsize=\maxdimen
+ \global\vsize=\maxdimen
+ \sa@papersize
+ \ifsa@multi
+ \begingroup
+ \@tempdima0.99626\paperwidth
+ \@tempdimb0.99626\paperheight
+ \edef\@tempc{\strip@pt\@tempdima}%
+ \edef\@tempd{\strip@pt\@tempdimb}%
+ \advance\@tempdima by .998pt
+ \advance\@tempdimb by .998pt
+ \def\strip@float##1.##2\relax{##1}%
+ \edef\@tempa{\expandafter\strip@float\the\@tempdima\relax}%
+ \edef\@tempb{\expandafter\strip@float\the\@tempdimb\relax}%
+ \special{ps::%
+ \@percentchar\@percentchar PageBoundingBox: 0 0 \@tempa\space\@tempb^^J%
+ \@percentchar\@percentchar HiResPageBoundingBox: 0 0 \@tempc\space\@tempd^^J%
+ \@percentchar\@percentchar BeginPageSetup^^J%
+ << /PageSize [\@tempc\space\@tempd]
+ >> setpagedevice^^J%<<
+ 0 0 bop^^J%
+ \@percentchar\@percentchar EndPageSetup}%
+ \endgroup
+ \fi
+ \topskip=0pt
+ \noindent\sa@ps@content
+ \newpage
+ }
+\def\sa@ps@content{%
+ \noindent\usebox\sa@box
+ \global\def\sa@ps@content{%
+ \@tempdima\sa@yoffset
+ \advance\@tempdima-\topskip
+ \dp\sa@box\z@
+ \ht\sa@box\z@
+ \noindent\lower\@tempdima\copy\sa@box
+ }%
+}
+\def\sa@papersize{%
+ \global\let\sa@papersize\relax
+ \special{papersize=\the\paperwidth,\the\paperheight}%
+ \global\sa@yoffset=\paperheight
+ \special{ps::%
+ \@percentchar\@percentchar HiResBoundingBox: 0 0 \the\paperwidth\space\the\paperheight^^J%
+ }%
+}
+\newlength\sa@yoffset
+\fi
\fi
\ifstandalonebeamer
\newenvironment{standaloneframe}{%
@@ -114,19 +669,108 @@
\begin{frame}#1[environment=standaloneframe,#2]%
}%
\fi
-\let\sa@cls@orig@document\document
-\let\sa@cls@orig@enddocument\enddocument
-\def\document{%
- \sa@cls@orig@document
- \let\documentclass\sa@documentclass % TODO: really required?
- \sa@cls@afterbegindocument
+\expandafter\ifx\csname sa@internal@run\endcsname\relax\else
+ \sa@convertfalse
+\fi
+\ifsa@convert
+\begingroup
+\let\on@line\@gobble
+\def\sa@convert#1{%
+ \IfFileExists{\outfile}{%
+ \edef\filemodbefore{\csname pdffilemoddate\endcsname{\outfile}}%
+ }{%
+ \IfFileExists{\outname\outext}{%
+ \edef\filemodbefore{\csname pdffilemoddate\endcsname{\outname\outext}}%
+ }{%
+ \IfFileExists{\outname-0\outext}{%
+ \edef\filemodbefore{\csname pdffilemoddate\endcsname{\outname-0\outext}}%
+ }{%
+ \IfFileExists{\outname-1\outext}{%
+ \edef\filemodbefore{\csname pdffilemoddate\endcsname{\outname-1\outext}}%
+ }{%
+ \def\filemodbefore{}%
+ }}}}%
+ \immediate\write18{\sa@convert@latex\space -jobname '\sa@convert@subjobname' '\noexpand\expandafter\def\noexpand\csname sa@internal@run\noexpand\endcsname{1}\noexpand\input{\jobname}'}%
+ \edef\sa@convert@precommand{\sa@convert@precommand}%
+ \ifx\sa@convert@precommand\@empty\else
+ \immediate\write18{\sa@convert@precommand}%
+ \fi
+ \immediate\write18{\sa@convert@command}%
+ \@tempswafalse
+ \IfFileExists{\outfile}{%
+ \@tempswatrue
+ }{%
+ \IfFileExists{\outname\outext}{%
+ \@tempswatrue
+ \def\outfile{\outname\outext}%
+ }{%
+ \IfFileExists{\outname-0\outext}{%
+ \@tempswatrue
+ \def\outfile{\outname-0\outext}%
+ }{%
+ \IfFileExists{\outname-1\outext}{%
+ \@tempswatrue
+ \def\outfile{\outname-1\outext}%
+ }{%
+ }}}}%
+ \if@tempswa
+ \edef\filemodafter{\csname pdffilemoddate\endcsname{\outfile}}%
+ \ifx\filemodbefore\filemodafter
+ \expandafter\ifx\csname pdffilemoddate\endcsname\relax\else
+ \sa@convert@failuremsg{standalone}{#1}{}%
+ \fi
+ \else
+ \ClassInfo{standalone}{Conversion successfull.}%
+ \fi
+ \else
+ \sa@convert@failuremsg{standalone}{#1}{}%
+ \fi
}
-\def\enddocument{%
- \sa@cls@beforeenddocument
- \sa@cls@orig@enddocument
+\let\subjobname\sa@convert@subjobname
+\let\infile\sa@convert@infile
+\let\inext\sa@convert@inext
+\let\inname\sa@convert@inname
+\let\gsdevice\sa@convert@gsdevice
+\let\convertexe\sa@convert@convertexe
+\let\gsexe\sa@convert@gsexe
+\let\density\sa@convert@density
+\let\size\sa@convert@size
+\let\outext\sa@convert@outext
+\let\outname\sa@convert@outname
+\let\outfile\sa@convert@outfile
+\let\percent\@percentchar
+\ifcase0%
+ \expandafter\ifx\csname pdfshellescape\endcsname\relax
+ \ifeof18 \else 3\fi
+ \else\the\pdfshellescape\fi
+\relax% 0
+ \sa@convert@failuremsg
+ {standalone}{Shell escape disabled! Cannot convert file '\infile'.}{}%
+\or% 1
+ \sa@convert{Conversion unsuccessful!\MessageBreak
+ There might be something wrong with your\MessageBreak
+ conversation software or the file permissions!}%
+\else% 2 or 3
+ \sa@convert{Conversion failed! Please ensure that shell escape\MessageBreak is enabled (e.g. use '-shell-escape').}%
+\fi
+\endgroup
+\expandafter\stop
+\fi
+\begingroup
+\toks@\expandafter{%
+ \document
+ \sa@cls@afterbegindocument
}
-\def\sa@cls@afterbegindocument{\expandafter\standalone\ignorespaces}
-\def\sa@cls@beforeenddocument{\unskip\endstandalone}
+\xdef\document{\the\toks@}%
+\toks@\expandafter{%
+ \expandafter
+ \sa@cls@beforeenddocument
+ \enddocument
+}
+\xdef\enddocument{\the\toks@}%
+\endgroup
+\def\sa@cls@afterbegindocument{\standalone\ignorespaces}
+\def\sa@cls@beforeenddocument{\ifhmode\unskip\fi\endstandalone}
\endinput
%%
%% End of file `standalone.cls'.
diff --git a/Master/texmf-dist/tex/latex/standalone/standalone.sty b/Master/texmf-dist/tex/latex/standalone/standalone.sty
index ce7c503e2bb..fbc050b6861 100644
--- a/Master/texmf-dist/tex/latex/standalone/standalone.sty
+++ b/Master/texmf-dist/tex/latex/standalone/standalone.sty
@@ -1,115 +1,260 @@
-%%
-%% This is file `standalone.sty',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% standalone.dtx (with options: `sty')
-%%
-%% Copyright (c) 2010 by Martin Scharrer <martin@scharrer-online.de>
-%%
+%% 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
+%% conditions of the LaTeX Project Public License, either version 1.3
%% 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.
-%%
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 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 2451 2011-04-07 11:40:38Z martin $
+%%
+%% This work consists of the files <+name+>.dtx and <+name+>.ins
+%% and the derived filebase <+name+>.sty.
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{standalone} [2011/04/07 v0.4a Package to include TeX sub-files with preambles]
-\expandafter\newif\csname ifstandalone\endcsname
-\standalonefalse
+\ProvidesPackage{standalone}[%
+ 2011/12/21
+ v1.0
+ Package to include TeX sub-files with preambles]
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\@ifundefined{ifstandalone}{%
+ \expandafter\newif\csname ifstandalone\endcsname
+ \standalonefalse
+}{}
\@ifundefined{ifstandalonebeamer}{%
-\expandafter\newif\csname ifstandalonebeamer\endcsname
-\standalonebeamerfalse
-}{}%
-\@ifundefined{onlyifstandalone}
- {\let\onlyifstandalone\@gobble}
- {}
+ \expandafter\newif\csname ifstandalonebeamer\endcsname
+ \standalonebeamerfalse
+}{}
+\@ifundefined{onlyifstandalone}{%
+ \let\onlyifstandalone\@gobble
+}{}
+\@ifundefined{IfStandalone}{%
+ \let\IfStandalone\@secondoftwo
+}{}
+\expandafter\ifx\csname ifluatex\endcsname\relax
+ \IfFileExists{ifluatex.sty}{\@firstoftwo}{\@secondoftwo}{%
+ \RequirePackage{ifluatex}
+ }{
+ \begingroup
+ \expandafter\ifx\csname directlua\endcsname\relax
+ \endgroup
+ \expandafter\let\csname ifluatex\expandafter\endcsname\csname iffalse\endcsname
+ \else
+ \endgroup
+ \expandafter\let\csname ifluatex\expandafter\endcsname\csname iftrue\endcsname
+ \fi
+ }
+\fi
+\expandafter\ifx\csname ifpdf\endcsname\relax
+ \IfFileExists{ifpdf.sty}{\@firstoftwo}{\@secondoftwo}{%
+ \RequirePackage{ifpdf}
+ }{
+ \begingroup
+ \expandafter\ifx\csname pdfoutput\endcsname\relax
+ \endgroup
+ \expandafter\let\csname ifpdf\expandafter\endcsname\csname iffalse\endcsname
+ \else
+ \endgroup
+ \ifnum\pdfoutput<1
+ \expandafter\let\csname ifpdf\expandafter\endcsname\csname iffalse\endcsname
+ \else
+ \expandafter\let\csname ifpdf\expandafter\endcsname\csname iftrue\endcsname
+ \fi
+ \fi
+ }
+\fi
+\expandafter\ifx\csname ifxetex\endcsname\relax
+ \IfFileExists{ifxetex.sty}{\@firstoftwo}{\@secondoftwo}{%
+ \RequirePackage{ifxetex}
+ }{
+ \begingroup
+ \expandafter\ifx\csname XeTeXrevision\endcsname\relax
+ \endgroup
+ \expandafter\let\csname ifxetex\expandafter\endcsname\csname iffalse\endcsname
+ \else
+ \endgroup
+ \expandafter\let\csname ifxetex\expandafter\endcsname\csname iftrue\endcsname
+ \fi
+ }
+\fi
\newif\ifsa@subpreambles
\newif\ifsa@sortsubpreambles
\newif\ifsa@printsubpreambles
-\DeclareOption{subpreambles}{%
- \sa@subpreamblestrue
+\newif\ifsa@group
+\newif\ifsa@obeyclassoptions
+\newif\ifsa@multi
+\newif\ifsa@tikz
+\newif\ifsa@varwidth
+\newif\ifsa@comments
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\RequirePackage{xkeyval}
+\def\sa@pkgoption{%
+ \define@key{standalone.sty}%
+}
+\def\sa@boolean#1#2{%
+ \sa@boolorvalue{#1}{#2}%
+ {\ClassError{standalone}{Invalid value '#2' for boolean key '#1'}{}}%
+}
+\def\sa@boolorvalue#1#2{%
+ \begingroup
+ \edef\@tempa{#2}%
+ \def\@tempb{true}%
+ \ifx\@tempa\@tempb
+ \endgroup
+ \csname sa@#1true\endcsname
+ \expandafter\@gobble
+ \else
+ \def\@tempb{false}%
+ \ifx\@tempa\@tempb
+ \endgroup
+ \csname sa@#1false\endcsname
+ \expandafter\expandafter
+ \expandafter\@gobble
+ \else
+ \endgroup
+ \expandafter\expandafter
+ \expandafter\@firstofone
+ \fi\fi
}
-\DeclareOption{sort}{%
- \sa@subpreamblestrue
- \sa@sortsubpreamblestrue
+\sa@pkgoption{sort}[true]{%
+ \sa@boolean{sortsubpreambles}{#1}%
+ \ifsa@sortsubpreambles
+ \sa@subpreamblestrue
+ \fi
}
-\DeclareOption{print}{%
- \sa@subpreamblestrue
- \sa@printsubpreamblestrue
+\sa@pkgoption{print}[true]{%
+ \sa@boolean{printsubpreambles}{#1}%
+ \ifsa@printsubpreambles
+ \sa@subpreamblestrue
+ \fi
}
-\DeclareOption{comments}{%
- \def\sa@percent{\@makeother\%}%
+\sa@pkgoption{subpreambles}[true]{%
+ \sa@boolean{subpreambles}{#1}%
}
-\DeclareOption{nocomments}{%
- \def\sa@percent{}%
+\sa@pkgoption{group}[true]{%
+ \sa@boolean{group}{#1}%
}
-\DeclareOption{mode=none}{%
- \let\sa@mode\relax
+\sa@grouptrue
+\sa@pkgoption{comments}[true]{%
+ \sa@boolean{comments}{#1}%
+ \ifsa@comments
+ \def\sa@percent{\@makeother\%}%
+ \else
+ \def\sa@percent{\catcode`\%=14\relax}%
+ \fi
}
-\DeclareOption{mode=pdf|tex}{%
- \def\sa@mode{0}%
+\sa@pkgoption{nocomments}[]{%
+ \begingroup
+ \def\@tempa{#1}%
+ \ifx\@tempa\@empty\else
+ \PackageWarning{standalone}{Unwanted value of 'nocomments' was ignored}{}A
+ \fi
+ \endgroup
+ \setkeys{standalone.sty}{comments=false}%
}
-\DeclareOption{mode=tex}{%
+\sa@pkgoption{mode}{%
+ \begingroup
+ \expandafter\let\expandafter\@tempa\csname sa@mode@#1\endcsname
+ \ifx\@tempa\relax
+ \endgroup
+ \PackageError{standalone}{Wrong value for option 'mode'}{}%
+ \else
+ \expandafter
+ \endgroup
+ \@tempa
+ \fi
+}
+\def\sa@mode@none{%
+ \let\sa@mode\relax%
+}
+\def\sa@mode@tex{%
\def\sa@mode{1}%
}
-\DeclareOption{mode=pdf}{%
+\def\sa@mode@image{%
\def\sa@mode{2}%
}
-\DeclareOption{mode=build}{%
+\@namedef{sa@mode@image|tex}{%
+ \def\sa@mode{0}%
+}
+\def\sa@mode@build{%
\def\sa@mode{3}%
}
-\DeclareOption{mode=buildnew}{%
+\def\sa@mode@buildmissing{%
\def\sa@mode{4}%
}
-\ProcessOptions*\relax
+\def\sa@mode@buildnew{%
+ \ifxetex
+ \PackageWarning{standalone}{The 'mode=buildnew' option is not available for XeTeX.\MessageBreak
+ Therefore 'mode=build' will be used instead}%
+ \def\sa@mode{3}%
+ \else
+ \def\sa@mode{5}%
+ \fi
+}
+\sa@mode@tex
+\sa@pkgoption{obeyclassoptions}[true]{%
+ \sa@boolean{obeyclassoptions}{#1}%
+}
+\sa@pkgoption{extension}{%
+ \def\sa@graphicext{#1}%
+}
+\def\sa@buildvar#1#2{%
+ \define@key{standalone.sty/build}{#1}{%
+ \@namedef{sa@build@#1}{##1}%
+ }%
+ \@namedef{sa@build@#1}{#2}%
+}
+\sa@buildvar{jobname}{\file}
+\sa@buildvar{latex}{}
+\sa@buildvar{latexoptions}{%
+ -interaction=batchmode -shell-escape -jobname '\buildjobname'
+}
+\sa@buildvar{command}{%
+ \latex\space\latexoptions\space\file
+}
+%% '\string\PassOptionsToClass{border=0pt}{standalone}\string\input{\image}'
+\def\sa@build@postcommand{}
+\ifpdf
+ \def\sa@graphicext{.pdf}
+ \ifluatex
+ \def\sa@build@latex{lualatex}
+ \else
+ \def\sa@build@latex{pdflatex}
+ \fi
+\else
+\ifxetex
+ \def\sa@graphicext{.pdf}
+ \def\sa@build@latex{xelatex}
+\else
+ \def\sa@graphicext{.eps}
+ \def\sa@build@latex{latex}
+ \def\sa@build@postcommand{dvips -o '\file.eps' '\file.dvi'}
+\fi\fi
+\ProcessOptionsX*<standalone.sty>\relax
+\disable@keys{standalone.sty}{subpreambles,print,sort}
\ifsa@printsubpreambles
\ifsa@sortsubpreambles\else
\@ifundefined{sa@percent}{%
- \def\sa@percent{\@makeother\%}%
+ \setkeys{standalone.sty}{comments=true}%
}{}%
\fi
\fi
-\@ifundefined{finkpath}{%
- \def\sa@rmspace#1 \empty{#1}%
- \def\sa@chkext#1.#2 \empty#3{%
- \ifx\empty#3\empty
- \sa@rmspace#1\empty.#2%
- \else
- #1.#2%
- \expandafter\sa@rmrest
- \fi
- }%
- \def\sa@rmrest tex \empty{}%
- \def\sa@filepath{\expandafter\sa@chkext\@filef@und\empty.tex \empty\empty}%
+\@ifclassloaded{standalone}{%
+ \def\standaloneconfig{%
+ \setkeys{standalone.sty,standalone.cls}%
+ }%
}{%
- \def\sa@filepath{\expandafter\expandafter\expandafter\sa@rmdotslash\expandafter\finkdir\finkfile\empty./\empty}%
- \def\sa@rmdotslash#1./#2\empty{%
- \ifx\empty#1\empty
- \sa@@rmdotslash#2%
- \else
- \ifx\empty#2\empty
- #1%
- \else
- \sa@@rmdotslash#1./#2%
- \fi
- \fi
- }
- \def\sa@@rmdotslash#1./\empty{#1}%
+ \newcommand*{\standaloneconfig}{%
+ \setkeys{standalone.sty}%
+ }%
}
+\RequirePackage{currfile}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifsa@subpreambles
\newwrite\sa@out
\def\sa@write{\immediate\write\sa@out}%
@@ -121,6 +266,7 @@
{\expandafter\sa@gobbleeol\expandafter\sa@removeonlyifstandalone\expandafter^^J\@gobble}%
}
\fi
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifsa@sortsubpreambles
\newcommand{\sa@usepackagewithoutoptions}[2][]{%
\sa@orig@usepackage{#2}%
@@ -381,35 +527,59 @@
}
\fi
\fi
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\sa@gobbleeol#1^^J{%
\@ifnextchar^^J%
{\sa@gobbleeol{#1}}{#1}%
}
-\def\sa@gobbleline#1^^J{}%
+\def\sa@endinput{%
+ \@makeother\%%
+ \@makeother\^^A%
+ \sa@@endinput
+}%
+\def\sa@@endinput#1^^J{%
+ \endgroup
+ \endinput
+}
+\def\sa@substbox{%
+ \leavevmode\hbox to 1pt{\vbox to 1pt{}}%
+}%
\long\def\standaloneignore#1\documentclass{%
\sa@documentclass
}
\@namedef{standaloneignore\space}{\standaloneignore}
\newcommand{\sa@documentclass}[2][]{%
\let\document\sa@document
+ \let\sa@subfile@options\@empty
+ \ifsa@obeyclassoptions
+ \begingroup
+ \edef\@tempa{#2}%
+ \edef\@tempb{standalone}%
+ \ifx\@tempa\@tempb
+ \endgroup
+ \def\sa@subfile@options{#1}%
+ \else
+ \endgroup
+ \fi
+ \fi
\begingroup
\ifsa@subpreambles
- \@ifundefined{sa@written@\sa@filepath}%
+ \@ifundefined{sa@written@\currfilepath}%
{%
\ifsa@printsubpreambles
\ifsa@sortsubpreambles
\begingroup
- \edef\@tempa{^^J\@percentchar\space Preamble from file '\sa@filepath'^^J}%
+ \edef\@tempa{^^J\@percentchar\space Preamble from file '\currfilepath'^^J}%
\expandafter\g@addto@macro\expandafter\sa@preamble\expandafter{\@tempa}%
\endgroup
\else
- \sa@write{^^J\@percentchar\space Preamble from file '\sa@filepath'}%
+ \sa@write{^^J\@percentchar\space Preamble from file '\currfilepath'}%
\fi
\else
- \sa@write{\string\subpreamble{\sa@filepath}}%
+ \sa@write{\string\subpreamble{\currfilepath}}%
\fi
}{}%
- \global\@namedef{subpreamble@\sa@filepath}{}%
+ \global\@namedef{subpreamble@\currfilepath}{}%
\ifsa@printsubpreambles
\endlinechar=`\^^J%
\else
@@ -426,8 +596,8 @@
\def\@tempa{#2}%
\ifx\@tempa\sa@gobbleto
\ifsa@subpreambles
- \expandafter\g@addto@macro\csname subpreamble@\sa@filepath\endcsname{#1}%
- \@ifundefined{sa@written@\sa@filepath}%
+ \expandafter\g@addto@macro\csname subpreamble@\currfilepath\endcsname{#1}%
+ \@ifundefined{sa@written@\currfilepath}%
{%
\ifsa@printsubpreambles
\ifsa@sortsubpreambles
@@ -444,33 +614,29 @@
\sa@write{\string\endsubpreamble}%
\fi
}{}%
- \global\@namedef{sa@written@\sa@filepath}{}%
+ \global\@namedef{sa@written@\currfilepath}{}%
\ifsa@printsubpreambles
\def\next{%
- \endgroup
- \PackageWarning{standalone}{Running 'standalone' package in sub-preamble print mode. All body content of file `\sa@filepath' is ignored!}{}{}%
- \hbox to 1pt{\vbox to 1pt{}}%
- \endinput
- %\sa@gobbleline
+ \PackageWarning{standalone}{Running 'standalone' package in sub-preamble print mode. All body content of file `\currfilepath' is ignored!}{}{}%
+ \sa@substbox
+ \sa@endinput
}%
\else
\expandafter
\ifx
- \csname prevsubpreamble@\sa@filepath \expandafter\endcsname
- \csname subpreamble@\sa@filepath \endcsname
+ \csname prevsubpreamble@\currfilepath\expandafter\endcsname
+ \csname subpreamble@\currfilepath\endcsname
\def\next{\expandafter\endgroup\expandafter\begin\expandafter{\sa@gobbleto}}%
\else
- %\expandafter\show\csname prevsubpreamble@\sa@filepath \endcsname
- %\expandafter\show\csname subpreamble@\sa@filepath \endcsname
+ %\expandafter\show\csname prevsubpreamble@\currfilepath\endcsname
+ %\expandafter\show\csname subpreamble@\currfilepath\endcsname
\def\next{%
- \endgroup
- \PackageWarning{standalone}{Sub-preamble of file '\sa@filepath' has changed. Content will be ignored. Please rerun LaTeX!}{}{}%
+ \PackageWarning{standalone}{Sub-preamble of file '\currfilepath' has changed. Content will be ignored. Please rerun LaTeX!}{}{}%
\immediate\write\@mainaux{%
\@percentchar\space standalone package info: Rerun LaTeX!
}%
- \hbox to 1pt{\vbox to 1pt{}}%
- \endinput
- %\sa@gobbleline
+ \sa@substbox
+ \sa@endinput
}%
\fi
\fi
@@ -479,8 +645,8 @@
\fi
\else
\ifsa@subpreambles
- \expandafter\g@addto@macro\csname subpreamble@\sa@filepath\endcsname{#1\begin{#2}}%
- \@ifundefined{sa@written@\sa@filepath}%
+ \expandafter\g@addto@macro\csname subpreamble@\currfilepath\endcsname{#1\begin{#2}}%
+ \@ifundefined{sa@written@\currfilepath}%
{\sa@write{\unexpanded{#1\begin{#2}}}}{}%
\fi
\def\next{\sa@gobble}%
@@ -515,30 +681,404 @@
{}
\let\sa@orig@document\document
\let\sa@orig@enddocument\enddocument
-\def\document{%
- \sa@orig@document
- \let\documentclass\sa@documentclass
- \ignorespaces
+\begingroup
+\toks@\expandafter{%
+ \document
+ \let\documentclass\sa@documentclass
+ \ignorespaces
+}
+\xdef\document{\the\toks@}%
+\endgroup
+\ifsa@obeyclassoptions
+\IfFileExists{varwidth.sty}{%
+ \RequirePackage{varwidth}%
+}{}
+\define@key{standalone.sty/class}{12pt}[]{%
+ \def\sa@subfile@size{12}%
+}
+\define@key{standalone.sty/class}{11pt}[]{%
+ \def\sa@subfile@size{11}%
+}
+\define@key{standalone.sty/class}{10pt}[]{%
+ \def\sa@subfile@size{10}%
+}
+\define@key{standalone.sty/class}{class}{%
+ \def\sa@subfile@class{#1}%
+}
+\define@key{standalone.sty/class}{multi}[true]{%
+ \sa@boolorvalue{multi}{#1}{%
+ \sa@multitrue\AtEndOfClass{\standaloneenv{#1}}%
+ }%
+ \ifsa@multi
+ \def\sa@requestedpage{1}%
+ \def\standaloneenv##1{%
+ \begingroup
+ \edef\@tempa{\endgroup\noexpand\@for\noexpand\@tempa:=\zap@space##1 \@empty}%
+ \@tempa\do{\expandafter\@standaloneenv\expandafter{\@tempa}}%
+ }%
+ \def\@standaloneenv##1{%
+ \expandafter\ifx\csname sa@orig@##1\endcsname\relax
+ \expandafter\let\csname sa@orig@##1\expandafter\endcsname\csname ##1\endcsname
+ \expandafter\let\csname sa@orig@end##1\expandafter\endcsname\csname end##1\endcsname
+ \fi
+ \expandafter\def\csname ##1\endcsname{%
+ \ifnum\sa@internal=0
+ \global\advance\sa@pagenum\@ne
+ \sa@boxit
+ \fi
+ \advance\sa@internal\@ne
+ \csname sa@orig@##1\endcsname
+ }%
+ \expandafter\def\csname end##1\endcsname{%
+ \csname sa@orig@end##1\endcsname
+ \advance\sa@internal\m@ne
+ \ifnum\sa@internal=0
+ \endsa@boxit
+ \ifx\sa@requestedpage\sa@allpages
+ \usebox\sa@box
+ \else
+ \ifnum\sa@requestedpage=\sa@pagenum
+ \usebox\sa@box
+ \fi\fi
+ \fi
+ \@ignoretrue
+ }%
+ }%
+ \else
+ \let\standaloneenv\@gobble
+ \fi
}
+\newcount\sa@internal
+\newcount\sa@pagenum
+\def\sa@allpages{-1}%
+\let\sa@box\@tempboxa
+\def\sa@boxit{%
+ \setbox\sa@box\hbox\bgroup\color@setgroup\sa@varwidth
+}%
+\def\endsa@boxit{%
+ \sa@endvarwidth\color@endgroup\egroup
+}%
+\define@key{standalone.sty/class}{tikz}[true]{%
+ \sa@boolean{tikz}{#1}%
+ \ifsa@tikz
+ \setkeys*{standalone.sty/class}{multi=tikzpicture,varwidth=false}%
+ \fi
+}
+\define@key{standalone.sty/class}{varwidth}[true]{%
+ \sa@boolorvalue{varwidth}{#1}{\sa@varwidthtrue\def\sa@width{#1}}%
+ \ifsa@varwidth
+ \expandafter\ifx\csname ver@varwidth.sty\endcsname\relax
+ \PackageWarning{standalone}{A standalone file which uses the varwidth package\MessageBreak
+ has been encountered while obeyclassoptions=true.\MessageBreak
+ Please load this package in the preamble.\MessageBreak
+ The file in question is loaded}%
+ \sa@varwidthfalse
+ \fi
+ \fi
+ \ifsa@varwidth
+ \def\sa@varwidth{\varwidth{\sa@width}}%
+ \def\sa@endvarwidth{\endvarwidth}%
+ \else
+ \let\sa@varwidth\@empty
+ \let\sa@endvarwidth\@empty
+ \fi
+}
+\let\sa@varwidth\@empty
+\let\sa@endvarwidth\@empty
+\def\sa@width{\linewidth}
+\define@key{standalone.sty/class}{beamer}[true]{%
+ \sa@boolean{beamer}{#1}%
+ \ifstandalonebeamer
+ \setkeys*{standalone.sty/class}{class=beamer,preview=false,crop=false,varwidth=false}%
+ \fi
+ \standalonebeamerfalse
+}
+\let\sa@beamertrue\standalonebeamertrue
+\let\sa@beamerfalse\standalonebeamerfalse
+\define@key{standalone.sty/class}{border}{%
+ \sa@readborder#1 {} {} {} {} \@nnil
+}
+\def\sa@border@left{0.50001bp}
+\let\sa@border@right\sa@border@left
+\let\sa@border@top\sa@border@left
+\let\sa@border@bottom\sa@border@left
+\def\rem@bp#1bp\relax#2\@nnil{#1}%
+\def\default@bp#1#2{%
+ \begingroup
+ \afterassignment\remove@to@nnil
+ \dimen@ #2bp\relax\@nnil
+ \expandafter
+ \endgroup
+ \expandafter
+ \def\expandafter#1\expandafter{\the\dimen@}%
+}
+\def\sa@readborder#1 #2 #3 #4 #5\@nnil{%
+ \ifx\\#2#3#4\\%
+ \default@bp\sa@border@left{#1}%
+ \let\sa@border@right\sa@border@left
+ \let\sa@border@top\sa@border@left
+ \let\sa@border@bottom\sa@border@left
+ \else
+ \ifx\\#4\\%
+ \default@bp\sa@border@left{#1}%
+ \let\sa@border@right\sa@border@left
+ \default@bp\sa@border@top{#2}%
+ \let\sa@border@bottom\sa@border@top
+ \else
+ \default@bp\sa@border@left{#1}%
+ \default@bp\sa@border@bottom{#2}%
+ \default@bp\sa@border@right{#3}%
+ \default@bp\sa@border@top{#4}%
+ \fi\fi
+}%
+\IfFileExists{adjustbox.sty}{%
+ \IfFileExists{trimclip.sty}{%
+ \RequirePackage{trimclip}%
+ }{%
+ \RequirePackage{adjustbox}%
+ }%
+ \def\sa@beginbox{%
+ \ifcase0%
+ \ifdim\sa@border@left<\z@ 1\fi
+ \ifdim\sa@border@right<\z@ 1\fi
+ \ifdim\sa@border@top<\z@ 1\fi
+ \ifdim\sa@border@bottom<\z@ 1\fi
+ \relax
+ \marginbox{{\sa@border@left} {\sa@border@bottom} {\sa@border@right} {\sa@border@top}}\bgroup
+ \else
+ \clipbox{{-\sa@border@left} {-\sa@border@bottom} {-\sa@border@right} {-\sa@border@top}}\bgroup
+ \fi
+ }%
+ \let\sa@endbox\egroup
+}{%
+ \PackageInfo{standalone}{The 'adjustbox' bundle was not found. Negative borders will not be clipped.}%
+ \def\sa@beginbox{%
+ \setbox\@tempboxa\color@hbox
+ }%
+ \def\sa@endbox{%
+ \color@endbox
+ \sbox\@tempboxa{%
+ \setlength\@tempdima{\sa@border@left}%
+ \hskip\@tempdima
+ \setlength\@tempdima{\sa@border@right}%
+ \setlength\@tempdimb{\sa@border@bottom}%
+ \setlength\@tempdimc{\sa@border@top}%
+ \advance\@tempdima\wd\@tempboxa
+ \wd\@tempboxa\@tempdima
+ \advance\@tempdimb\dp\@tempboxa
+ \dp\@tempboxa\@tempdimb
+ \advance\@tempdimc\ht\@tempboxa
+ \ht\@tempboxa\@tempdimc
+ \raise\dp\@tempboxa\box\@tempboxa
+ }%
+ \usebox\@tempboxa
+ }%
+}
+\fi
\def\sa@document{%
- \let\enddocument\sa@enddocument
- \sa@atbegindocument
+ \ifsa@group
+ \let\enddocument\sa@enddocument
+ \ifx\sa@subfile@options\@empty\else
+ \def\sa@subfile@size{10}%
+ \def\sa@subfile@class{article}%
+ \let\NeedsTeXFormat\@gobble
+ \let\sa@atendofclass\@empty
+ \def\AtEndOfClass{\g@addto@macro\sa@atendofclass}%
+ \def\standaloneconfig{\setkeys*{standalone.sty/class}}%
+ \let\sa@@latex@error\@latex@error
+ \let\@latex@error\@gobbletwo
+ \let\sa@selectfont\selectfont
+ \let\selectfont\relax
+ \makeatletter
+ \nullfont
+ \InputIfFileExists{standalone.cfg}{}{}%
+ \begingroup
+ \def\@tempa{\setkeys*{standalone.sty/class}}%
+ \expandafter\expandafter
+ \expandafter\endgroup
+ \expandafter\@tempa\expandafter{\sa@subfile@options}%
+ \sa@atendofclass
+ \ifpdf
+ \ifx\GPT@page\@empty\else
+ \let\sa@requestedpage\GPT@page
+ \fi
+ \else
+ \ifxetex
+ \ifx\Gin@XeTeX@page\@empty\else
+ \let\sa@requestedpage\Gin@XeTeX@page
+ \fi
+ \fi\fi
+ \sa@pagenum\z@
+ \sa@beginbox
+ \@ifundefined{KOMAClassName}{%
+ \def\@tempa{size}%
+ }{%
+ \def\@tempa##1##2##3##4\relax{\def\@tempa{##1##2##3}}%
+ \expandafter\@tempa\sa@subfile@class{}{}{}\relax
+ \def\@tempb{scr}%
+ \ifx\@tempa\@tempb
+ \def\@tempa##1{scrsize##1pt}%
+ \else
+ \def\@tempa{size}%
+ \fi
+ }%
+ \let\sa@newcommand\newcommand
+ \let\sa@@ifundefined\@ifundefined
+ \let\newcommand\renewcommand
+ \let\@ifundefined\@thirdofthree
+ \edef\@tempa{%
+ \noexpand\input{\@tempa\sa@subfile@size.clo}%
+ \catcode`\noexpand\@=\the\catcode`\@
+ }\@tempa
+ \let\newcommand\sa@newcommand
+ \let\@latex@error\sa@@latex@error
+ \let\@ifundefined\sa@@ifundefined
+ \let\selectfont\sa@selectfont
+ \normalsize
+ \fi
+ \else
+ \endgroup
+ \global\let\enddocument\sa@enddocument
+ \fi
+ \sa@atbegindocument
}
\def\sa@enddocument{%
- \sa@atenddocument
- \aftergroup\sa@@enddocument
-}
-\def\sa@@enddocument{%
- %\let\document\sa@orig@document
- \let\enddocument\sa@orig@enddocument
- \endinput
+ \sa@atenddocument
+ \ifsa@group
+ \ifx\sa@subfile@options\@empty\else
+ \sa@endbox
+ \fi
+ \else
+ \global\let\document\sa@orig@document
+ \global\let\enddocument\sa@orig@enddocument
+ \begingroup
+ \def\@currenvir{document}%
+ \fi
+ \@ignoretrue
+ \aftergroup\endinput
}
\def\sa@atbegindocument{%
\ignorespaces
}%
\def\sa@atenddocument{%
- \unskip
+ \ifhmode\unskip\fi
}%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\IfFileExists{gincltex.sty}{%
+ \RequirePackage{gincltex}
+ \newcommand*\includestandalone[2][]{%
+ \begingroup
+ \setkeys*{standalone.sty}{##1}%
+ \edef\@tempa{{##2\sa@graphicext}}%
+ \expandafter\expandafter\expandafter\includestandalone@
+ \expandafter\expandafter\expandafter{\expandafter\XKV@rm\expandafter}\@tempa{##2}%
+ \endgroup
+ }
+}{%
+ \begingroup
+ \let\on@line\@gobble
+ \PackageWarning{standalone}{Required package 'gincltex' not found.\MessageBreak
+ The \string\includestandalone\space feature is disabled.}
+ \endgroup
+ \newcommand*\includestandalone[2][]{%
+ \begingroup
+ \input{##2}%
+ \endgroup
+ }
+}
+\ifxetex\else
+ \RequirePackage{filemod-expmin}
+\fi
+\newif\ifsa@buildsuccess
+%% 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{#2}%
+ {\includegraphics[#1]{#2}}%
+ {\includegraphics[#1]{#3.tex}}%
+ \or% 1
+ \includegraphics[#1]{#3.tex}%
+ \or% 2
+ \includegraphics[#1]{#2}%
+ \or% 3
+ \sa@buildgraphic{#3}%
+ \ifsa@buildsuccess
+ \includegraphics[#1]{#2}%
+ \else
+ \PackageWarning{standalone}%
+ {Graphic '#2' could not be build.^^J%
+ Shell escape activated?}%
+ \includegraphics[#1]{#3.tex}%
+ \fi
+ \or% 4
+ \IfFileExists{#2}%
+ {\includegraphics[#1]{#2}}%
+ {\sa@buildgraphic{#3}%
+ \ifsa@buildsuccess
+ \includegraphics[#1]{#2}%
+ \else
+ \PackageWarning{standalone}%
+ {Graphic '#2' could not be build.^^J%
+ Shell escape activated?}%
+ \includegraphics[#1]{#3.tex}%
+ \fi
+ }%
+ \or% 5
+ \filemodCmp{#3.tex}{#2}%
+ {\sa@buildgraphic{#3}%
+ \ifsa@buildsuccess
+ \includegraphics[#1]{#2}%
+ \else
+ \PackageWarning{standalone}%
+ {Graphic '#2' could not be build.^^J%
+ Shell escape activated?}%
+ \includegraphics[#1]{#3.tex}%
+ \fi
+ }%
+ {%
+ \PackageInfo{standalone}%
+ {#3.tex file newer then #2}%
+ \includegraphics[#1]{#2}%
+ }%
+ \fi
+}
+\def\sa@buildgraphic#1{%
+ \ifeof18
+ \PackageError{standalone}{Shell escape needed to create graphic! Use the '-shell-escape' option.}{}%
+ \else
+ \begingroup
+ \edef\file{#1}%
+ \edef\outfile{\file\sa@graphicext}%
+ \edef\filemodbefore{\csname pdffilemoddate\endcsname{\outfile}}%
+ \let\latex\sa@build@latex
+ \let\latexoptions\sa@build@latexoptions
+ \let\buildjobname\sa@build@jobname
+ \immediate\write18{\sa@build@command}%
+ \ifx\sa@build@postcommand\@empty\else
+ \immediate\write18{\sa@build@postcommand}%
+ \fi
+ \IfFileExists{\outfile}{%
+ \edef\filemodafter{\csname pdffilemoddate\endcsname{\outfile}}%
+ \ifx\filemodbefore\filemodafter
+ \expandafter\ifx\csname pdffilemoddate\endcsname\relax
+ \global\sa@buildsuccesstrue
+ \else
+ \global\sa@buildsuccessfalse
+ \fi
+ \else
+ \global\sa@buildsuccesstrue
+ \fi
+ }{%
+ \global\sa@buildsuccessfalse
+ }%
+ \endgroup
+ \fi
+}
\endinput
%%
%% End of file `standalone.sty'.
diff --git a/Master/texmf-dist/tex/latex/standalone/standalone.tex b/Master/texmf-dist/tex/latex/standalone/standalone.tex
deleted file mode 100644
index 4d1617fbe91..00000000000
--- a/Master/texmf-dist/tex/latex/standalone/standalone.tex
+++ /dev/null
@@ -1,9 +0,0 @@
-% $Id: standalone.dtx 2451 2011-04-07 11:40:38Z martin $
-\ProvidesFile{standalone.tex}[2011/04/07 v0.4a Provides if-switch to show if file is compiled standalone]%
-\expandafter\ifx\csname ifstandalone\endcsname\relax
-\expandafter\newif\csname ifstandalone\endcsname
-\expandafter\ifx\csname @twoclasseserror\endcsname\documentclass
-\else
- \standalonetrue
-\fi
-\fi