summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-03-25 21:25:52 +0000
committerKarl Berry <karl@freefriends.org>2018-03-25 21:25:52 +0000
commit4aa51574f9198035e1261f69c6873f7dc0ea5789 (patch)
treeb20c48dc114e9fa815fbfd111b421bb5cbc11bb4
parent7797b94583f26cd24bfa620b9579bf7d83352ca8 (diff)
standalone (25mar18)
git-svn-id: svn://tug.org/texlive/trunk@47110 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/standalone/README2
-rw-r--r--Master/texmf-dist/doc/latex/standalone/standalone.pdfbin267402 -> 270926 bytes
-rw-r--r--Master/texmf-dist/source/latex/standalone/standalone.dtx194
-rw-r--r--Master/texmf-dist/tex/latex/standalone/standalone.cfg7
-rw-r--r--Master/texmf-dist/tex/latex/standalone/standalone.cls97
-rw-r--r--Master/texmf-dist/tex/latex/standalone/standalone.sty54
6 files changed, 262 insertions, 92 deletions
diff --git a/Master/texmf-dist/doc/latex/standalone/README b/Master/texmf-dist/doc/latex/standalone/README
index b88c7ecc2e9..577a44994c3 100644
--- a/Master/texmf-dist/doc/latex/standalone/README
+++ b/Master/texmf-dist/doc/latex/standalone/README
@@ -1,6 +1,6 @@
LaTeX class and package 'standalone'
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Copyright (c) 2010-2012 by Martin Scharrer <martin@scharrer-online.de>
+Copyright (c) 2010-2018 by Martin Scharrer <martin@scharrer-online.de>
Repository: http://bitbucket.org/martin_scharrer/standalone
Allows TeX pictures or other TeX code in sub-files to be compiled standalone
diff --git a/Master/texmf-dist/doc/latex/standalone/standalone.pdf b/Master/texmf-dist/doc/latex/standalone/standalone.pdf
index cd09e889b2d..a7d1c095059 100644
--- a/Master/texmf-dist/doc/latex/standalone/standalone.pdf
+++ b/Master/texmf-dist/doc/latex/standalone/standalone.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/standalone/standalone.dtx b/Master/texmf-dist/source/latex/standalone/standalone.dtx
index 194eed9e9eb..30884fd6d9a 100644
--- a/Master/texmf-dist/source/latex/standalone/standalone.dtx
+++ b/Master/texmf-dist/source/latex/standalone/standalone.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%<=*COPYRIGHT>
-%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
+%% Copyright (C) 2011-2017 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.3
@@ -26,10 +26,10 @@
\NeedsTeXFormat{LaTeX2e}
\ProvidesFile{standalone.dtx}[%
%<=*DATE>
- 2015/07/15
+ 2018/03/24
%<=/DATE>
%<=*VERSION>
- v1.2
+ v1.3
%<=/VERSION>
DTX file of the standalone bundle]
\documentclass[a4paper,11pt]{ydoc}
@@ -89,6 +89,7 @@
% manual.}
% \changes{v1.1b}{2012/09/15}{Fixed issue with 'subpreambles' for Beamer documents.}
% \changes{v1.2}{2012/12/31}{Fixed build issue with MiKTeX due to incorrect quoting character.}
+% \changes{v1.3}{2018/03/24}{Several fixes for new driver and LuaTeX versions. Other minor fixes in bundle and manual.}
%
% \GetFileInfo{\jobname.dtx}
%
@@ -115,7 +116,7 @@
% }%
% \fi
% \author{Martin Scharrer}
-% \email{martin@scharrer.me}
+% \email{martin@scharrer-online.de}
% \repository{https://bitbucket.org/martin_scharrer/standalone}
% \maketitle
%
@@ -133,13 +134,24 @@
% \tableofcontents
% \end{multicols}
%
+% \section{Online Resources and Help}
+% This bundle is released on the comprehensive \TeX\ archive network (CTAN) under \url{https://ctan.org/pkg/standalone}.
+% Any modern \LaTeX\ distribution should pick it from there automatically, though. CTAN now allows votes and comments on packages and such feedback is very welcome.
+%
+% The source code of this bundle is hosted on Bitbucket as Mercurial repository under \url{https://bitbucket.org/martin_scharrer/standalone/}.
+% The ticket system there should be used to report bugs or request new features: \url{https://bitbucket.org/martin_scharrer/standalone/issues/new}.
+%
+% User which need help with should search for an existing solution on the site TeX.Stackexchange.com: \url{https://tex.stackexchange.com/questions/tagged/standalone}
+% or post a new question: \url{https://tex.stackexchange.com/questions/ask?tags=standalone}.
+% The bundle author is an active user on TeX.SE but other users might help as well.
+%
% \section{Installation}
-% This package is part of the two main \LaTeX\ distributions \emph{TeX Live} and \emph{MikTeX} and can be easily installed
+% This bundle is part of the two main \LaTeX\ distributions \emph{TeX Live} and \emph{MikTeX} and can be easily installed
% with their package managers. It is also provided as TDS ZIP file on CTAN which can be used for a manual install.
% Other packages are also required as described in \autoref{sec:dep}.
%
% \subsection{Installation with TeX Live}
-% Using a normal TeX Live the package is easily installed using the package manager \texttt{tlmgr}.
+% Using a normal TeX Live the bundle is easily installed using the package manager \texttt{tlmgr}.
% The command \texttt{tlmgr install \csname @package\endcsname} will install it and \texttt{tlmgr update \csname
% @package\endcsname} can be used to update it.
%
@@ -148,11 +160,11 @@
% regular package updates.
%
% \subsection{Installation with MikTeX}
-% The package can be easily installed using the MikTeX package manager as described by
+% The bundle can be easily installed using the MikTeX package manager as described by
% \url{http://docs.miktex.org/manual/pkgmgt.html}. The MikTeX package name is identical to the normal package name.
%
% \subsection{Manual Installation from CTAN}
-% The package is also available on the Comprehensive TeX Archive Network (CTAN), both as the DTX/INS files and as TDS
+% The bundle is also available on the Comprehensive TeX Archive Network (CTAN), both as the DTX/INS files and as TDS
% ZIP file, which can be used for a manual install. A manual install is only required if the used distribution does not
% include the (required version of the) package.
%
@@ -182,7 +194,7 @@
%
% \subsection{Dependencies}\label{sec:dep}
% The \cls{standalone} class and package require the \pkg{xkeyval} package.
-% The packages \pkg{ifpdf}, \pkg{ifluatex} and \pkg{ifxetex} are loaded if available, otherwise some fall-back code is used.
+% The packages \pkg{ifpdf}, \pkg{ifluatex}, \pkg{ifxetex}, and \pkg{shellesc} are loaded if available, otherwise some fall-back code is used.
% If enabled the class options \opt{varwidth}, \opt{preview} and \opt{beamer} require the package or class of the same name.
%
% The \pkg{standalone} package requires the \pkg{currfile} package (which in turn uses \pkg{filehook}) to track the correct file names of
@@ -361,7 +373,7 @@
%
% \DescribeKey{border}'='<length (all sides)>
% \DescribeKey{border}'='{<length (left/right)>~<length (bottom/top)>}
-% \DescribeKey{border}'='{<length (left)>~<length (right)>~<length (bottom)>~<length (top)>}
+% \DescribeKey{border}'='{<length (left)>~<length (bottom)>~<length (right)>~<length (top)>}
% This option allows to specify the border used by the \opt{preview} and \opt{crop} options.
% An alternative name of this option is \opt{margin}.
% The border can either be given using a single value for all sides, separately for the horizontal and vertical borders or for all sides separately.
@@ -601,6 +613,8 @@
% the following default settings are used: PNG format, a density of 300dpi, no explicit size and the output file name is given by \Macro\jobname, i.e.\ the name of the \LaTeX\ document.
% Using the \opt{convert} option with any value other than |false| will enabled it.
% All normal conversion settings are listed in \autoref{tab:convopt}, while \autoref{tab:advconvopt} lists the more advanced options which e.g.\ can be used to modify the conversion command directly.
+% Note that macros used inside documentclass options must be protected from expansion. This can either be done wrapping the whole argument in an \Macro\unexpanded{..} (requires e-\TeX)
+% or by using \Macro\noexpand in front of any macro.
%
% \begin{table}
% \vspace*{-10ex}%
@@ -639,15 +653,16 @@
% \midrule
% command & Command line used for conversion. & (see |imagemagick|) \\
% imagemagick & Sets the convert command to use Image Magick: \newline\bigskip
-% \hspace*{-5em}\hbox{\vtop{\hbox{\strut|command={\convertexe\space -density \density\space |\vrule height 2\ht\strutbox width 0pt{}\egroup
-% \hbox\bgroup\strut| \infile\space \ifx\size\empty\else |\egroup
-% \hbox\bgroup\strut| -resize \size\fi\space -quality 90 \outfile}|}}\hss} \\
+% \hspace*{-5em}\hbox{\vtop{\hbox{\strut|command=\unexpanded{{\convertexe\space -density \density\space |\vrule height 2\ht\strutbox width 0pt{}}%
+% \hbox{\strut| \infile\space \ifx\size\empty\else |}%
+% \hbox{\strut| -resize \size\fi\space -quality 90 \outfile}}|}}\hss} \\
% convertexe & Name of the executable of Image Magick. & (see \autoref{sec:convprogs}) \\
% ghostscript & Sets the convert command to use Ghostscript: \newline\bigskip
-% \hspace*{-5em}\hbox{\vtop{\hbox{\strut|command={\gsexe\space -dSAFER -dBATCH -dNOPAUSE -sDEVICE=\gsdevice\space|\vrule height 2\ht\strutbox width 0pt{}\egroup
-% \hbox\bgroup\strut| -r\density\space -sOutputFile=\outfile\space \infile}|}}\hss} \\
+% \hspace*{-5em}\hbox{\vtop{\hbox{\strut|command=\unexpanded{{\gsexe\space -dSAFER -dBATCH -dNOPAUSE|\vrule height 2\ht\strutbox width 0pt{}}%
+% \hbox{\strut| -sDEVICE=\gsdevice\space -r\density\space|}%
+% \hbox{\strut| -sOutputFile=\outfile\space \infile}}|}}\hss} \\
% gsexe & Name of the executable of Ghostscript. & (see \autoref{sec:convprogs}) \\
-% precommand & Command to be executed before the actual conversion command. & {\tabular[t]{@{}l@{}}|dvips \jobname| (DVI/PS),\\empty (PDF)\endtabular} \\
+% precommand & Command to be executed before the actual conversion command. & {\tabular[t]{@{}l@{}}|dvips \subjobname| (DVI/PS),\\empty (PDF)\endtabular} \\
% gsdevice & The output device to be used for ghostscript. Already set up for PNG and JPG output. & \parbox[t]{15em}{Uses known device if defined for output format, otherwise the output format itself.}\\
% onfailure & Sets if an type of `message' which should be triggered on conversion failure: |error|, |warning|, |info| or |ignore|. & |warning| \\
% \bottomrule
@@ -819,7 +834,7 @@
% With only the \opt{subpreambles} option set, the sub-preambles are simple read and executed unchanged. This includes the risk of option clashes if one package is loaded with different
% options inside the sub-preambles and/or the main preamble. This is avoided by the \opt{sort} option, which accumulates all packages loaded by all sub-files together with their options.
% The options are then marked to be loaded by the package using \LaTeX{}s \cs{PassOptionsToPackage} macro. The packages are loaded at the end of the preamble using the \cs{AtBeginDocument} hook.
-% This allows the user to load the same packages with own options in the main file, after the |subversion| package is loaded, without any option clashes.
+% This allows the user to load the same packages with own options in the main file, after the |standalone| package is loaded, without any option clashes.
%
% \DescribeKey{print}'=true|false'
% While the \opt{sort} option is giving already good results, problems with the order of packages can still occur. Some packages provide, redefine or patch the same macros, so that they must be loaded in
@@ -1228,6 +1243,17 @@
% Define if-switches for TeX formats.
% This loads the corresponding packages if available, but falls back to some own code if they are not installed.
% \begin{macrocode}
+\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}
@@ -1809,7 +1835,7 @@
% \begin{key}{standalone.cls/convert}{imagemagick}
% \begin{macrocode}
\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
}
% \end{macrocode}
@@ -1865,7 +1891,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
% \end{macrocode}
@@ -2383,8 +2409,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
@@ -2458,10 +2497,14 @@
% \begin{macrocode}
\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}%
}%
}
% \end{macrocode}
@@ -2536,7 +2579,7 @@
% \begin{macrocode}
\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
@@ -2578,20 +2621,31 @@
\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
\ifnum\c@sapage=\z@
@@ -2622,9 +2676,9 @@
% \begin{macrocode}
\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}}%
@@ -2665,7 +2719,22 @@
% \begin{macrocode}
\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
@@ -2801,6 +2870,17 @@
% Define if-switches for TeX formats.
% This loads the corresponding packages if available, but falls back to some own code if they are not installed.
% \begin{macrocode}
+\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}
@@ -3638,10 +3718,13 @@
% Process |.sta| file from last run. All changes must be made by own macros which define the value globally.
% Therefore the input is wrapped in a group. Some spaces or special line endings could process typeset content,
% which causes errors inside the preamble. To be on the save side the input `content' is stored in a temp box.
+% The normal catcode of the `@' character is restored because comparing the previous subpreamble with the current one
+% would fail otherwise if the |standalone| package is loaded while |\makeatletter| is active.
% \begin{macrocode}
\begingroup
\setbox\@tempboxa\hbox{%
- \InputIfFileExists{\jobname.sta}{}{\PackageInfo{standalone}{STA file not found!}{}{}}%
+ \makeatother
+ \InputIfFileExists{\jobname.sta}{}{\PackageInfo{standalone}{STA file not found!}{}{}}%
}%
\endgroup
% \end{macrocode}
@@ -4023,6 +4106,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
@@ -4268,16 +4354,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
% Determinate required size files (normal classes or KOMA Script).
@@ -4480,7 +4557,21 @@
% The state of the shell escape is checked.
% \begin{macrocode}
\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
@@ -4492,9 +4583,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}}%
@@ -4591,7 +4682,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.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 <martin@scharrer-online.de>
+%% Copyright (C) 2011-2017 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.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 <martin@scharrer-online.de>
+%% Copyright (C) 2011-2017 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.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}}%