summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/standalone/standalone.sty
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/standalone/standalone.sty
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/standalone/standalone.sty')
-rw-r--r--Master/texmf-dist/tex/latex/standalone/standalone.sty776
1 files changed, 658 insertions, 118 deletions
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'.