diff options
author | Karl Berry <karl@freefriends.org> | 2015-07-17 22:41:42 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-07-17 22:41:42 +0000 |
commit | de0e37b2f2d2da31dfe9bcbfbb27140db33fad40 (patch) | |
tree | d38854a57b1d412acfa51256c0e4c56058940dbe /Master/texmf-dist/tex/latex/standalone | |
parent | 62111b5c7ed986bbc803ac5f044c49b508f5dde1 (diff) |
standalone (16jul15)
git-svn-id: svn://tug.org/texlive/trunk@37875 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/standalone')
-rw-r--r-- | Master/texmf-dist/tex/latex/standalone/standalone.cfg | 4 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/standalone/standalone.cls | 123 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/standalone/standalone.sty | 69 |
3 files changed, 143 insertions, 53 deletions
diff --git a/Master/texmf-dist/tex/latex/standalone/standalone.cfg b/Master/texmf-dist/tex/latex/standalone/standalone.cfg index 7d9441c8585..b62438547d8 100644 --- a/Master/texmf-dist/tex/latex/standalone/standalone.cfg +++ b/Master/texmf-dist/tex/latex/standalone/standalone.cfg @@ -1,7 +1,7 @@ \NeedsTeXFormat{LaTeX2e} \ProvidesFile{standalone.cfg}[% - 2012/09/15 - v1.1b + 2015/07/15 + v1.2 Default configuration file for 'standalone' class]% %% Enabled the "varwidth" option if the "varwidth" package is available: %%\IfFileExists{varwidth.sty}{% diff --git a/Master/texmf-dist/tex/latex/standalone/standalone.cls b/Master/texmf-dist/tex/latex/standalone/standalone.cls index 84c696f0d31..958de71d619 100644 --- a/Master/texmf-dist/tex/latex/standalone/standalone.cls +++ b/Master/texmf-dist/tex/latex/standalone/standalone.cls @@ -18,8 +18,8 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesClass{standalone}[% - 2012/09/15 - v1.1b + 2015/07/15 + v1.2 Class to compile TeX sub-files standalone] \newif\ifstandalone \standalonetrue @@ -111,6 +111,7 @@ \newif\ifsa@preview \newif\ifsa@crop \newif\ifsa@multi +\newif\ifsa@multido \newif\ifsa@varwidth \newif\ifsa@ignorerest \newif\ifsa@ignoreempty @@ -177,6 +178,12 @@ \sa@clsoption{multi}[true]{% \sa@boolorvalue{multi}{#1}{\sa@multitrue\AtBeginDocument{\standaloneenv{#1}}}% } +\sa@clsoption{multido}[true]{% + \sa@boolean{multido}{#1}% + \ifsa@multido + \setkeys{standalone.cls}{multi=samultido}% + \fi +} \sa@clsoption{math}[true]{% \sa@boolean{math}{#1}% \ifsa@math @@ -383,9 +390,11 @@ } \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}% + \let\sa@convert@pageoffset\m@ne } \sa@convertoption{ghostscript}[]{% \def\sa@convert@command{\gsexe\space -dSAFER -dBATCH -dNOPAUSE -sDEVICE=\gsdevice\space -r\density\space -sOutputFile=\outfile\space \infile}% + \let\sa@convert@pageoffset\z@ } \sa@convertvar{latexoptions}{ -shell-escape } \sa@convertvar{subjobname}{\jobname} @@ -397,7 +406,8 @@ \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{outfile}{\outname\ifsa@multi\sa@multi@pagemark\fi\outext} +\def\sa@multi@pagemark{-\percent0d}% \sa@convertvar{density}{300} \sa@convertvar{gsdevice}{% \expandafter\ifx\csname sa@gsdevice@\outext\endcsname\relax @@ -460,6 +470,7 @@ \newcommand*{\standaloneconfig}{\setkeys{standalone.cls}} \let\@standaloneenv\@gobble \newcount\sa@internal +\newcounter{sapage} \let\standalone\empty \let\endstandalone\relax \def\sa@width{\linewidth} @@ -473,6 +484,36 @@ \AtBeginDocument{% \disable@keys{standalone.cls}{multi}% } +\expandafter\expandafter\expandafter\LoadClass +\expandafter\expandafter\expandafter[% +\expandafter\@classoptionslist +\expandafter]\expandafter{\sa@class} +\ifsa@ignorerest + \def\sa@startignore{\sa@boxit} +\else + \let\sa@startignore\relax +\fi +\ifsa@ignorerest + \def\sa@stopignore{\endsa@boxit} +\else + \let\sa@stopignore\relax +\fi +\ifsa@multido +\RequirePackage{multido} +\let\sa@orig@multido@\multido@ +\renewcommand{\multido@}[6]{% + \sa@stopignore + \sa@orig@multido@{#1}{#2}{#3}{#4}{#5}{% + \sa@startignore + \begin{samultido}% + \let\multido@\sa@orig@multido@ + #6% + \end{samultido}% + \sa@stopignore + }% + \sa@startignore +} +\fi \ifsa@convert \ifx\sa@convert@quote\relax \begingroup @@ -502,10 +543,6 @@ \fi \fi \fi -\expandafter\expandafter\expandafter\LoadClass -\expandafter\expandafter\expandafter[% -\expandafter\@classoptionslist -\expandafter]\expandafter{\sa@class} \ifsa@varwidth \RequirePackage{varwidth} \fi @@ -532,6 +569,7 @@ \fi \expandafter\def\csname #1\endcsname{% \ifnum\sa@internal=0 + \addtocounter{sapage}\@ne \preview \sa@varwidth \fi @@ -572,17 +610,13 @@ }% \renewenvironment{standalone}{% \ifsa@multi - \ifsa@ignorerest - \sa@boxit - \fi + \sa@startignore \else \sa@boxit \fi }{% \ifsa@multi - \ifsa@ignorerest - \endsa@boxit - \fi + \sa@stopignore \else \endsa@boxit \sa@handlebox @@ -599,6 +633,7 @@ \fi \expandafter\def\csname #1\endcsname{% \ifnum\sa@internal=0 + \addtocounter{sapage}\@ne \edef\@tempa{\endgroup \noexpand\endsa@boxit \begingroup @@ -629,6 +664,7 @@ \fi \expandafter\def\csname #1\endcsname{% \ifnum\sa@internal=0 + \addtocounter{sapage}\@ne \sa@boxit \fi \advance\sa@internal\@ne @@ -773,6 +809,9 @@ }% \fi \expandafter\ifx\csname sa@internal@run\endcsname\relax\else + \AtEndDocument{% + \immediate\write\@mainaux{\gdef\noexpand\sa@multi@numpages{\arabic{sapage}}}% + } \sa@convertfalse \fi \ifsa@convert @@ -794,8 +833,8 @@ }{% \def\filemodbefore{}% }}}}% - \edef\@tempa{\jobname} - \edef\@tempb{\sa@convert@subjobname} + \edef\@tempa{\jobname}% + \edef\@tempb{\sa@convert@subjobname}% \@onelevel@sanitize\@tempa \@onelevel@sanitize\@tempb \@tempswafalse @@ -809,6 +848,34 @@ -jobname \sa@convert@quote\sa@convert@subjobname\sa@convert@quote\space \sa@convert@quote\string\expandafter\string\def\string\csname\space sa@internal@run\string\endcsname{1}\string\input{\sa@convert@mainfile}\sa@convert@quote}% + \begingroup + \gdef\sa@multi@numpages{1}% + \IfFileExists{\sa@convert@subjobname.aux}{% + \globaldefs=\m@ne + \@@input\sa@convert@subjobname.aux\relax + \globaldefs=\z@ + \xdef\sa@multi@numpages{\sa@multi@numpages}% + }{}% + \endgroup + \setcounter{sapage}{\sa@multi@numpages}% + \addtocounter{sapage}\sa@convert@pageoffset + \ifnum\c@sapage=\z@ + \def\sa@multi@pagemark{}% + \edef\sa@lastoutfile{\outfile}% + \else + \@tempcnta\z@ + \loop\ifnum\value{sapage}>0 + \advance\@tempcnta\@ne + \divide\c@sapage by 10\relax + \repeat + \edef\sa@multi@pagemark{-\percent0\the\@tempcnta d}% + \begingroup + \setcounter{sapage}{\sa@multi@numpages}% + \addtocounter{sapage}\sa@convert@pageoffset + \def\sa@multi@pagemark{-\arabic{sapage}}% + \xdef\sa@lastoutfile{\outfile}% + \endgroup + \fi \if@tempswa \edef\infile@filemodafter{\csname pdffilemoddate\endcsname{\infile}}% \ifx\infile@filemodbefore\infile@filemodafter @@ -821,34 +888,18 @@ \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}}% + \IfFileExists{\sa@lastoutfile}{% + \edef\filemodafter{\csname pdffilemoddate\endcsname{\sa@lastoutfile}}% \ifx\filemodbefore\filemodafter \expandafter\ifx\csname pdffilemoddate\endcsname\relax\else \sa@convert@failuremsg{standalone}{#1}{}% \fi \else - \typeout{Class standalone:^^JOutput written on \outfile.}% + \typeout{Class standalone:^^JOutput written on \sa@lastoutfile.}% \fi - \else + }{% \sa@convert@failuremsg{standalone}{#1}{}% - \fi + }% } \let\subjobname\sa@convert@subjobname \let\mainfile\sa@convert@mainfile diff --git a/Master/texmf-dist/tex/latex/standalone/standalone.sty b/Master/texmf-dist/tex/latex/standalone/standalone.sty index 15c9d4dcf99..362b68a4795 100644 --- a/Master/texmf-dist/tex/latex/standalone/standalone.sty +++ b/Master/texmf-dist/tex/latex/standalone/standalone.sty @@ -19,8 +19,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{standalone}[% - 2012/09/15 - v1.1b + 2015/07/15 + v1.2 Package to include TeX sub-files with preambles] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \@ifundefined{ifstandalone}{% @@ -38,48 +38,48 @@ \let\IfStandalone\@secondoftwo }{} \expandafter\ifx\csname ifluatex\endcsname\relax - \IfFileExists{ifluatex.sty}{\@firstoftwo}{\@secondoftwo}{% + \IfFileExists{ifluatex.sty}{ \RequirePackage{ifluatex} }{ \begingroup \expandafter\ifx\csname directlua\endcsname\relax \endgroup - \expandafter\let\csname ifluatex\expandafter\endcsname\csname iffalse\endcsname + \global\expandafter\let\csname ifluatex\expandafter\endcsname\csname iffalse\endcsname \else \endgroup - \expandafter\let\csname ifluatex\expandafter\endcsname\csname iftrue\endcsname + \global\expandafter\let\csname ifluatex\expandafter\endcsname\csname iftrue\endcsname \fi } \fi \expandafter\ifx\csname ifpdf\endcsname\relax - \IfFileExists{ifpdf.sty}{\@firstoftwo}{\@secondoftwo}{% + \IfFileExists{ifpdf.sty}{ \RequirePackage{ifpdf} }{ \begingroup \expandafter\ifx\csname pdfoutput\endcsname\relax \endgroup - \expandafter\let\csname ifpdf\expandafter\endcsname\csname iffalse\endcsname + \global\expandafter\let\csname ifpdf\expandafter\endcsname\csname iffalse\endcsname \else \endgroup \ifnum\pdfoutput<1 - \expandafter\let\csname ifpdf\expandafter\endcsname\csname iffalse\endcsname + \global\expandafter\let\csname ifpdf\expandafter\endcsname\csname iffalse\endcsname \else - \expandafter\let\csname ifpdf\expandafter\endcsname\csname iftrue\endcsname + \global\expandafter\let\csname ifpdf\expandafter\endcsname\csname iftrue\endcsname \fi \fi } \fi \expandafter\ifx\csname ifxetex\endcsname\relax - \IfFileExists{ifxetex.sty}{\@firstoftwo}{\@secondoftwo}{% + \IfFileExists{ifxetex.sty}{ \RequirePackage{ifxetex} }{ \begingroup \expandafter\ifx\csname XeTeXrevision\endcsname\relax \endgroup - \expandafter\let\csname ifxetex\expandafter\endcsname\csname iffalse\endcsname + \global\expandafter\let\csname ifxetex\expandafter\endcsname\csname iffalse\endcsname \else \endgroup - \expandafter\let\csname ifxetex\expandafter\endcsname\csname iftrue\endcsname + \global\expandafter\let\csname ifxetex\expandafter\endcsname\csname iftrue\endcsname \fi } \fi @@ -204,6 +204,9 @@ \sa@pkgoption{extension}{% \def\sa@graphicext{#1}% } +\sa@pkgoption{build}[]{% + \setkeys{standalone.sty/build}{#1}% +} \def\sa@buildvar#1#2{% \define@key{standalone.sty/build}{#1}{% \@namedef{sa@build@#1}{##1}% @@ -212,8 +215,10 @@ } \sa@buildvar{jobname}{\file} \sa@buildvar{latex}{} +\sa@buildvar{quote}{} +\let\sa@build@quote\relax \sa@buildvar{latexoptions}{% - -interaction=batchmode -shell-escape -jobname '\buildjobname' + -interaction=batchmode -shell-escape -jobname \quote\buildjobname\quote } \sa@buildvar{command}{% \latex\space\latexoptions\space\file @@ -234,10 +239,42 @@ \else \def\sa@graphicext{.eps} \def\sa@build@latex{latex} - \def\sa@build@postcommand{dvips -o '\file.eps' '\file.dvi'} + \def\sa@build@postcommand{dvips -o \quote\file.eps\quote\space \quote\file.dvi\quote} \fi\fi \ProcessOptionsX*<standalone.sty>\relax \disable@keys{standalone.sty}{subpreambles,print,sort} +\def\sa@setquote{% + \ifx\sa@build@quote\relax + \expandafter\ifx\csname sa@convert@quote\endcsname\relax + \begingroup + \@tempswafalse + \expandafter\ifx\csname pdftexbanner\endcsname\relax + \@tempswatrue + \else + \def\MiKTeX{MiKTeX} + \@onelevel@sanitize\MiKTeX + \expandafter\def\expandafter\testmiktex\expandafter##\expandafter1\MiKTeX##2\relax{% + \ifx\empty##2\empty + \@tempswafalse + \else + \@tempswatrue + \fi + } + \expandafter\expandafter + \expandafter\testmiktex\expandafter\pdftexbanner\MiKTeX\relax\relax + \fi + \expandafter + \endgroup + \if@tempswa + \def\sa@build@quote{"} + \else + \def\sa@build@quote{'} + \fi + \else + \let\sa@build@quote\sa@convert@quote + \fi + \fi +} \ifsa@printsubpreambles \ifsa@sortsubpreambles\else \@ifundefined{sa@percent}{% @@ -1044,7 +1081,7 @@ }% {% \PackageInfo{standalone}% - {#3.tex file newer then #2}% + {generated file #2 newer then source file #3.tex}% \includegraphics[#1]{#2}% }% \fi @@ -1060,6 +1097,8 @@ \let\latex\sa@build@latex \let\latexoptions\sa@build@latexoptions \let\buildjobname\sa@build@jobname + \sa@setquote + \let\quote\sa@build@quote \immediate\write18{\sa@build@command}% \ifx\sa@build@postcommand\@empty\else \immediate\write18{\sa@build@postcommand}% |