From 4aa51574f9198035e1261f69c6873f7dc0ea5789 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 25 Mar 2018 21:25:52 +0000 Subject: standalone (25mar18) git-svn-id: svn://tug.org/texlive/trunk@47110 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/tex/latex/standalone/standalone.cfg | 7 +- .../texmf-dist/tex/latex/standalone/standalone.cls | 97 +++++++++++++++++----- .../texmf-dist/tex/latex/standalone/standalone.sty | 54 ++++++++---- 3 files changed, 117 insertions(+), 41 deletions(-) (limited to 'Master/texmf-dist/tex/latex/standalone') diff --git a/Master/texmf-dist/tex/latex/standalone/standalone.cfg b/Master/texmf-dist/tex/latex/standalone/standalone.cfg index b62438547d8..38649960e92 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}[% - 2015/07/15 - v1.2 + 2018/03/24 + v1.3 Default configuration file for 'standalone' class]% %% Enabled the "varwidth" option if the "varwidth" package is available: %%\IfFileExists{varwidth.sty}{% @@ -12,7 +12,10 @@ \standaloneconfig{crop} %% Option which 'preview' should be loaded with +%% (will be ignored outside preamble) +\expandafter\ifx\csname @notprerr\endcsname\PassOptionsToPackage\else \PassOptionsToPackage{active,tightpage}{preview}% +\fi %% Enable 'preview' option by default: %%\standaloneconfig{preview} diff --git a/Master/texmf-dist/tex/latex/standalone/standalone.cls b/Master/texmf-dist/tex/latex/standalone/standalone.cls index 958de71d619..6d653925f10 100644 --- a/Master/texmf-dist/tex/latex/standalone/standalone.cls +++ b/Master/texmf-dist/tex/latex/standalone/standalone.cls @@ -1,4 +1,4 @@ -%% Copyright (C) 2011-2012 by Martin Scharrer +%% Copyright (C) 2011-2017 by Martin Scharrer %% --------------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -18,8 +18,8 @@ %% \NeedsTeXFormat{LaTeX2e} \ProvidesClass{standalone}[% - 2015/07/15 - v1.2 + 2018/03/24 + v1.3 Class to compile TeX sub-files standalone] \newif\ifstandalone \standalonetrue @@ -60,6 +60,17 @@ \default@bp\sa@border@top{#4}% \fi\fi }% +\expandafter\ifx\csname ShellEscape\endcsname\relax + \IfFileExists{shellesc.sty}{ + \RequirePackage{shellesc} + \@ifpackagelater{shellesc}{2016/04/29}{ + }{ + \protected\def\ShellEscape{\immediate\write18 } + } + }{ + \protected\def\ShellEscape{\immediate\write18 } + } +\fi \expandafter\ifx\csname ifluatex\endcsname\relax \IfFileExists{ifluatex.sty}{\@firstoftwo}{\@secondoftwo}{% \RequirePackage{ifluatex} @@ -389,7 +400,7 @@ \sa@convertvar{outext}{.svg} } \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}% + \def\sa@convert@command{\convertexe\space -density \density\space -units PixelsPerInch \infile\space \ifx\size\empty\else -resize \size\fi\space -quality 90 \outfile}% \let\sa@convert@pageoffset\m@ne } \sa@convertoption{ghostscript}[]{% @@ -436,7 +447,7 @@ \else \sa@convertvar{latex}{latex} \sa@convertvar{inext}{.ps} - \sa@convertvar{precommand}{dvips \jobname.dvi} + \sa@convertvar{precommand}{dvips \subjobname.dvi} \setkeys{standalone.cls/convert}{ghostscript} \fi\fi\fi \begingroup @@ -711,8 +722,21 @@ \relax \def\sa@placebox{% \newpage - \global\pdfpagewidth=\wd\sa@box - \global\pdfpageheight=\ht\sa@box + \ifluatex + \ifnum\luatexversion<85 + % LuaLaTeX < 0.85 does define the PDF-specific globals. + \global\pdfpagewidth=\wd\sa@box + \global\pdfpageheight=\ht\sa@box + \else + % LuaLaTeX >= 0.85 doesn't define the PDF-specific globals. + \global\pagewidth=\wd\sa@box + \global\pageheight=\ht\sa@box + \fi + \else + % Not LuaLaTeX at all, so still need this. + \global\pdfpagewidth=\wd\sa@box + \global\pdfpageheight=\ht\sa@box + \fi \global\paperwidth=\wd\sa@box \global\paperheight=\ht\sa@box \global\hsize=\wd\sa@box @@ -768,10 +792,14 @@ } \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% + \global\setbox\@begindvibox\vbox{% + \special{papersize=\the\paperwidth,\the\paperheight}% + \special{ps::% + \@percentchar\@percentchar HiResBoundingBox: 0 0 \the\paperwidth\space\the\paperheight^^J% + }% + \unvbox\@begindvibox + \special{papersize=\the\paperwidth,\the\paperheight}% }% } \newlength\sa@yoffset @@ -810,7 +838,7 @@ \fi \expandafter\ifx\csname sa@internal@run\endcsname\relax\else \AtEndDocument{% - \immediate\write\@mainaux{\gdef\noexpand\sa@multi@numpages{\arabic{sapage}}}% + \immediate\write\@mainaux{\noexpand\@gobbletwo\noexpand\sa@multi@setnumpages{\arabic{sapage}}}% } \sa@convertfalse \fi @@ -844,18 +872,28 @@ \else \global\let\sa@convert@stop\relax \fi - \immediate\write18{\sa@convert@latex\space\sa@convert@latexoptions\space + \ShellEscape{\sa@convert@latex\space\sa@convert@latexoptions\space -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}% - }{}% + \IfFileExists{\sa@convert@subjobname.aux}{\@tempswatrue}{\@tempswafalse}% + \if@tempswa + \newread\sa@read + \def\@tempa##1\sa@multi@setnumpages##2##3\@nnil{% + \def\@tempc{##2}% + \ifx\@tempc\@nnil\else + \gdef\sa@multi@numpages{##2}% + \fi + }% + \endlinechar=\m@ne + \immediate\openin\sa@read=\sa@convert@subjobname.aux\relax + \loop\unless\ifeof\sa@read + \read\sa@read to\@tempb + \expandafter\@tempa\@tempb\sa@multi@setnumpages\@nil\@empty\@nnil + \repeat + \immediate\closein\sa@read + \fi \endgroup \setcounter{sapage}{\sa@multi@numpages}% \addtocounter{sapage}\sa@convert@pageoffset @@ -884,9 +922,9 @@ \fi \edef\sa@convert@precommand{\sa@convert@precommand}% \ifx\sa@convert@precommand\@empty\else - \immediate\write18{\sa@convert@precommand}% + \ShellEscape{\sa@convert@precommand}% \fi - \immediate\write18{\sa@convert@command}% + \ShellEscape{\sa@convert@command}% \@tempswafalse \IfFileExists{\sa@lastoutfile}{% \edef\filemodafter{\csname pdffilemoddate\endcsname{\sa@lastoutfile}}% @@ -918,7 +956,22 @@ \let\quote\sa@convert@quote \ifcase0% \expandafter\ifx\csname pdfshellescape\endcsname\relax - \ifeof18 \else 3\fi + \ifcase + \ifx\pdfshellescape\@undefined + \ifx\shellescape\@undefined + \ifx\directlua\@undefined + \z@ + \else + \directlua{% + tex.sprint((status.shell_escape or os.execute()) .. " ")} + \fi + \else + \shellescape + \fi + \else + \pdfshellescape + \fi + \else 3\fi \else\the\pdfshellescape\fi \relax% 0 \sa@convert@failuremsg diff --git a/Master/texmf-dist/tex/latex/standalone/standalone.sty b/Master/texmf-dist/tex/latex/standalone/standalone.sty index 362b68a4795..785289a87d2 100644 --- a/Master/texmf-dist/tex/latex/standalone/standalone.sty +++ b/Master/texmf-dist/tex/latex/standalone/standalone.sty @@ -1,4 +1,4 @@ -%% Copyright (C) 2011-2012 by Martin Scharrer +%% Copyright (C) 2011-2017 by Martin Scharrer %% --------------------------------------------------------------------------- %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either version 1.3 @@ -19,8 +19,8 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{standalone}[% - 2015/07/15 - v1.2 + 2018/03/24 + v1.3 Package to include TeX sub-files with preambles] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \@ifundefined{ifstandalone}{% @@ -37,6 +37,17 @@ \@ifundefined{IfStandalone}{% \let\IfStandalone\@secondoftwo }{} +\expandafter\ifx\csname ShellEscape\endcsname\relax + \IfFileExists{shellesc.sty}{ + \RequirePackage{shellesc} + \@ifpackagelater{shellesc}{2016/04/29}{ + }{ + \protected\def\ShellEscape{\immediate\write18 } + } + }{ + \protected\def\ShellEscape{\immediate\write18 } + } +\fi \expandafter\ifx\csname ifluatex\endcsname\relax \IfFileExists{ifluatex.sty}{ \RequirePackage{ifluatex} @@ -539,7 +550,8 @@ \else \begingroup \setbox\@tempboxa\hbox{% - \InputIfFileExists{\jobname.sta}{}{\PackageInfo{standalone}{STA file not found!}{}{}}% + \makeatother + \InputIfFileExists{\jobname.sta}{}{\PackageInfo{standalone}{STA file not found!}{}{}}% }% \endgroup @@ -773,6 +785,9 @@ \advance\sa@internal\m@ne \ifnum\sa@internal=0 \endsa@boxit + \ifx\sa@requestedpage\@empty +\let\sa@requestedpage\sa@allpages + \fi \ifx\sa@requestedpage\sa@allpages \usebox\sa@box \else @@ -937,16 +952,7 @@ \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 + \let\sa@requestedpage\Gin@page \sa@pagenum\z@ \sa@beginbox \@ifundefined{KOMAClassName}{% @@ -1087,7 +1093,21 @@ \fi } \def\sa@buildgraphic#1{% - \ifeof18 + \ifcase + \ifx\pdfshellescape\@undefined + \ifx\shellescape\@undefined + \ifx\directlua\@undefined + \z@ + \else + \directlua{% + tex.sprint((status.shell_escape or os.execute()) .. " ")} + \fi + \else + \shellescape + \fi + \else + \pdfshellescape + \fi \PackageError{standalone}{Shell escape needed to create graphic! Use the '-shell-escape' option.}{}% \else \begingroup @@ -1099,9 +1119,9 @@ \let\buildjobname\sa@build@jobname \sa@setquote \let\quote\sa@build@quote - \immediate\write18{\sa@build@command}% + \ShellEscape{\sa@build@command}% \ifx\sa@build@postcommand\@empty\else - \immediate\write18{\sa@build@postcommand}% + \ShellEscape{\sa@build@postcommand}% \fi \IfFileExists{\outfile}{% \edef\filemodafter{\csname pdffilemoddate\endcsname{\outfile}}% -- cgit v1.2.3