diff options
author | Karl Berry <karl@freefriends.org> | 2011-03-01 23:44:06 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-03-01 23:44:06 +0000 |
commit | 8f4172befed36d7074c76019c9ffd6b67a22ce17 (patch) | |
tree | 8ecf1ba5d6f28b0ae7b632569d8ff5b2322992ed /Master/texmf-dist/tex/latex/standalone | |
parent | f59620f253808e843e73159d36397cb4f15ec93a (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/tex/latex/standalone')
5 files changed, 289 insertions, 40 deletions
diff --git a/Master/texmf-dist/tex/latex/standalone/gincltex.sty b/Master/texmf-dist/tex/latex/standalone/gincltex.sty new file mode 100644 index 00000000000..390395fb549 --- /dev/null +++ b/Master/texmf-dist/tex/latex/standalone/gincltex.sty @@ -0,0 +1,125 @@ +%% +%% This is file `gincltex.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% gincltex.dtx (with options: `package') +%% +%% 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. +%% +\RequirePackage{svn-prov} +\ProvidesPackage{gincltex} + [2011/01/23 v0.1 Include external LaTeX files like graphics] +\newif\if@gincltex@bbfile +\DeclareOption{bb=file}{\@gincltex@bbfiletrue} +\DeclareOption{bb=aux}{\@gincltex@bbfilefalse} +\ProcessOptions*\relax +\RequirePackage{pgf} + +\@namedef{Gin@rule@.tex}#1{{tex}{.tex}{#1}} +\newsavebox\gincltex@box +\def\gincltex@input#1{% + {\let\Gin@ext\relax\input{#1}}% +} +\def\Ginclude@tex#1{% + \begingroup + \ifvoid\gincltex@box + \sbox\gincltex@box{{\gincltex@input{#1}}}% + \fi + \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}% + \Gscale@@box\totalheight{\Gin@req@width}{\Gin@req@height}{% + \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}% + }% + \endgroup +} +\if@gincltex@bbfile +\@ifundefined{gincltex@bbout}{\newwrite\gincltex@bbout}{} +\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 + }% +} +\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 +} +\else +\def\Gread@tex@setbb#1#2#3#4{% + \def\Gin@llx{#1}% + \def\Gin@lly{#2}% + \def\Gin@urx{#3}% + \def\Gin@ury{#4}% +} +\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 +} +\def\gincltex@bb#1#2#3#4#5{% + \global\@namedef{gincltex@bb@#1}{{#2}{#3}{#4}{#5}}% +} +\fi +\endinput +%% +%% End of file `gincltex.sty'. diff --git a/Master/texmf-dist/tex/latex/standalone/standalone.cfg b/Master/texmf-dist/tex/latex/standalone/standalone.cfg index 592cd2e7fc1..308dc5cccd5 100644 --- a/Master/texmf-dist/tex/latex/standalone/standalone.cfg +++ b/Master/texmf-dist/tex/latex/standalone/standalone.cfg @@ -1,5 +1,5 @@ -% $Id: standalone.dtx 1772 2010-03-27 13:50:59Z martin $ -\ProvidesFile{standalone.cfg}[2010/03/27 v0.3a Default configuration file for 'standalone' class]% +% $Id: standalone.dtx 2194 2011-02-28 19:26:29Z martin $ +\ProvidesFile{standalone.cfg}[2010/02/28 v0.4 Default configuration file for 'standalone' class]% \PassOptionsToPackage{active,tightpage}{preview}% \ifstandalonebeamer diff --git a/Master/texmf-dist/tex/latex/standalone/standalone.cls b/Master/texmf-dist/tex/latex/standalone/standalone.cls index c899c181ba2..e4fbcbc12c1 100644 --- a/Master/texmf-dist/tex/latex/standalone/standalone.cls +++ b/Master/texmf-dist/tex/latex/standalone/standalone.cls @@ -25,9 +25,9 @@ %% This work consists of the files standalone.dtx, standalone.ins %% and the derived file standalone.sty. %% -% $Id: standalone.dtx 1772 2010-03-27 13:50:59Z martin $ +% $Id: standalone.dtx 2194 2011-02-28 19:26:29Z martin $ \NeedsTeXFormat{LaTeX2e} -\ProvidesClass{standalone} [2010/03/27 v0.3a Class to compile TeX sub-files standalone] +\ProvidesClass{standalone} [2010/02/28 v0.4 Class to compile TeX sub-files standalone] \newif\ifstandalone \standalonetrue \newif\ifstandalonebeamer @@ -36,6 +36,8 @@ \RequirePackage{kvoptions} \SetupKeyvalOptions{prefix=sa@} \DeclareBoolOption[true]{preview} +\DeclareStringOption{border} +\let\sa@border\relax \DeclareVoidOption{beamer}{% \def\sa@class{beamer}% \sa@previewfalse @@ -63,6 +65,23 @@ {\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 + }% + \@firstofone{\expandafter\sa@readborder\sa@border} {} {} {} {} \relax + \endgroup + \fi \fi \ifstandalonebeamer \newenvironment{standaloneframe}{% diff --git a/Master/texmf-dist/tex/latex/standalone/standalone.sty b/Master/texmf-dist/tex/latex/standalone/standalone.sty index 8333ee65eec..4c83a7d2bd3 100644 --- a/Master/texmf-dist/tex/latex/standalone/standalone.sty +++ b/Master/texmf-dist/tex/latex/standalone/standalone.sty @@ -25,9 +25,9 @@ %% This work consists of the files standalone.dtx, standalone.ins %% and the derived file standalone.sty. %% -% $Id: standalone.dtx 1772 2010-03-27 13:50:59Z martin $ +% $Id: standalone.dtx 2194 2011-02-28 19:26:29Z martin $ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{standalone} [2010/03/27 v0.3a Package to include TeX sub-files with preambles] +\ProvidesPackage{standalone} [2010/02/28 v0.4 Package to include TeX sub-files with preambles] \expandafter\newif\csname ifstandalone\endcsname \standalonefalse \@ifundefined{ifstandalonebeamer}{% @@ -57,6 +57,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 \ifsa@printsubpreambles \ifsa@sortsubpreambles\else @@ -220,38 +238,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% } -\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} \def\sa@collpgflibs{}% \def\sa@sortpgflibs#1{% \@for\lib:=#1\do {% @@ -389,6 +385,7 @@ \@ifnextchar^^J% {\sa@gobbleeol{#1}}{#1}% } +\def\sa@gobbleline#1^^J{}% \long\def\standaloneignore#1\documentclass{% \sa@documentclass } @@ -452,9 +449,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 @@ -469,10 +467,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 @@ -540,6 +539,112 @@ \def\sa@atenddocument{% \unskip }% +\expandafter\ifx\csname sa@mode\endcsname\relax\else +\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 +} +\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 index 550f483bde4..251f6f6e175 100644 --- a/Master/texmf-dist/tex/latex/standalone/standalone.tex +++ b/Master/texmf-dist/tex/latex/standalone/standalone.tex @@ -1,5 +1,5 @@ -% $Id: standalone.dtx 1772 2010-03-27 13:50:59Z martin $ -\ProvidesFile{standalone.tex}[2010/03/27 v0.3a Provides if-switch to show if file is compiled standalone]% +% $Id: standalone.dtx 2194 2011-02-28 19:26:29Z martin $ +\ProvidesFile{standalone.tex}[2010/02/28 v0.4 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 |