summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/standalone/standalone.cls
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 /Master/texmf-dist/tex/latex/standalone/standalone.cls
parent7797b94583f26cd24bfa620b9579bf7d83352ca8 (diff)
standalone (25mar18)
git-svn-id: svn://tug.org/texlive/trunk@47110 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/standalone/standalone.cls')
-rw-r--r--Master/texmf-dist/tex/latex/standalone/standalone.cls97
1 files changed, 75 insertions, 22 deletions
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