diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
-rw-r--r-- | Master/texmf-dist/tex/latex/svg/svg-extract.sty | 6 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/svg/svg.sty | 378 |
2 files changed, 256 insertions, 128 deletions
diff --git a/Master/texmf-dist/tex/latex/svg/svg-extract.sty b/Master/texmf-dist/tex/latex/svg/svg-extract.sty index 6231ffa6329..cb1c1fa12b3 100644 --- a/Master/texmf-dist/tex/latex/svg/svg-extract.sty +++ b/Master/texmf-dist/tex/latex/svg/svg-extract.sty @@ -31,12 +31,12 @@ %% svg-example.svg, svg-preamble.tex and root.C (with derived file root.svg). %% %% -\NeedsTeXFormat{LaTeX2e}[2019-10-01] +\NeedsTeXFormat{LaTeX2e}[2020-02-02] \ProvidesPackage{svg-extract}[% - 2020/01/13 v2.02e\space% + 2020/05/07 v2.02f\space% (extract independent graphics from SVG pictures)% ] -\RequirePackage{svg}[2017/03/27] +\RequirePackage{svg}[2020/05/07] \DefineFamily{SVG} \DefineFamilyMember{SVG} \newif\if@svgx@run diff --git a/Master/texmf-dist/tex/latex/svg/svg.sty b/Master/texmf-dist/tex/latex/svg/svg.sty index 02cbf11be31..826e8a23b19 100644 --- a/Master/texmf-dist/tex/latex/svg/svg.sty +++ b/Master/texmf-dist/tex/latex/svg/svg.sty @@ -31,17 +31,17 @@ %% svg-example.svg, svg-preamble.tex and root.C (with derived file root.svg). %% %% -\NeedsTeXFormat{LaTeX2e}[2019-10-01] +\NeedsTeXFormat{LaTeX2e}[2020-02-02] \ProvidesPackage{svg}[% - 2020/01/13 v2.02e\space% + 2020/05/07 v2.02f\space% (include SVG pictures)% ] -\RequirePackage{iftex}[2019/11/07] -\RequirePackage{scrbase}[2019/12/23] -\RequirePackage{pdftexcmds}[2016/05/21] -\RequirePackage{shellesc}[2016/06/07] +\RequirePackage{iftex}[2020/03/06] +\RequirePackage{scrbase}[2020/04/19] +\RequirePackage{pdftexcmds}[2019/11/24] +\RequirePackage{shellesc}[2019/11/08] \RequirePackage{trimspaces}[2009/09/17] -\RequirePackage{graphicx}[1999/02/16] +\RequirePackage{graphicx}[2019/11/30] \newcommand*\svg@tempa{} \newcommand*\svg@tempb{} \newbox\svg@box @@ -77,7 +77,7 @@ }% \fi% \if@svg@use@transparent% - \RequirePackage{transparent}[2016/05/16]% + \RequirePackage{transparent}[2019/11/29]% \else% \AfterPackage*{transparent}{% \PackageWarning{svg}{Package `transparent' was loaded anyway}% @@ -166,6 +166,47 @@ } \DeclareOption{on}{\FamilyOptions{SVG}{inkscape=true}} \DeclareOption{off}{\FamilyOptions{SVG}{inkscape=false}} +\newcommand*\svg@ink@ver{\m@ne} +\DefineFamilyKey{SVG}{inkscapeversion}[true]{% + \FamilySetNumerical{SVG}{inkscape}{svg@tempa}{% + {true}{0},{on}{0},{yes}{0},{auto}{0},{detect}{0},{determine}{0},{fetch}{0},% + {enquire}{0},{identify}{0},{request}{0},{retrieve}{0},{obtain}{0}% + }{#1}% + \ifx\FamilyKeyState\FamilyKeyStateProcessed% + \renewcommand*\svg@ink@ver{\m@ne}% + \else% + \def\svg@tempa##1.##2\@nil{% + \Ifnumber{##1}{% + \renewcommand*\svg@ink@ver{##1}% + \FamilyKeyStateProcessed% + }{}% + }% + \svg@tempa#1.\@nil% + \fi% +} +\newcommand*\svg@ink@exe{inkscape} +\DefineFamilyKey{SVG}{inkscapeexe}{% + \svg@sanitize@dq\svg@ink@exe{#1}% + \FamilyKeyStateProcessed% +} +\newcommand*\svg@ink@opt{} +\DefineFamilyKey{SVG}{inkscapeopt}{% + \renewcommand*\svg@ink@opt{#1}% + \FamilyKeyStateProcessed% +} +\def\svg@tempa#1{% + \AtBeginDocument{% + \DefineFamilyKey[]{SVG}{#1}[]{% + \PackageError{svg}{Option `#1' too late}{% + Option `#1' can only be set within\MessageBreak% + the preamble but you have tried to set it up later.% + }% + \FamilyKeyStateProcessed% + }% + }% +} +\svg@tempa{inkscapeexe} +\svg@tempa{inkscapeversion} \newcommand*\svg@ink@format{pdf} \ifxetex\else\ifpdf\else \renewcommand*\svg@ink@format{eps} @@ -222,15 +263,17 @@ }% } \DefineFamilyKey{SVG}{inkscapedensity}{\FamilyOptions{SVG}{inkscapedpi=#1}} -\newcommand*\svg@ink@exe{inkscape} -\DefineFamilyKey{SVG}{inkscapeexe}{% - \renewcommand*\svg@ink@exe{#1}% - \FamilyKeyStateProcessed% -} -\newcommand*\svg@ink@opt{} -\DefineFamilyKey{SVG}{inkscapeopt}{% - \renewcommand*\svg@ink@opt{#1}% - \FamilyKeyStateProcessed% +\newcommand*\svg@ink@cmd[2]{% + \svg@ink@exe\space"#1.\svg@file@ext"\space\svg@ink@area\space% + \ifx\svg@ink@dpi\relax\else--export-dpi=\svg@ink@dpi\space\fi% + \if@svg@ink@latex--export-latex\space\fi% + \ifx\svg@ink@opt\@empty\else\svg@ink@opt\space\fi% + \ifnum\svg@ink@ver=\z@% + --without-gui\space% + --export-\svg@ink@format="#2.\svg@ink@format"% + \else% + --export-filename="#2.\svg@ink@format"% + \fi% } \DefineFamilyKey{SVG}{svgpath}{% \PackageWarning{svg}{% @@ -588,7 +631,7 @@ \svg@dummy@key[true]{clear} \svg@dummy@key[true]{exclude} \FamilyExecuteOptions{SVG}{% - inkscape=true,inkscapepath=basesubdir, + inkscape=true,inkscapeversion=auto,inkscapepath=basesubdir, inkscapelatex=true,inkscapearea=drawing,distort=false,% usexcolor=true,usetransparent=true% } @@ -701,52 +744,6 @@ }% }% } -\newcommand*\svg@file@missing[3][]{% - \begingroup% - \svg@quotes@remove[{#2}]{\svg@tempa}% - \svg@filename@parse[{#1}]{\svg@tempa}% - \IfArgIsEmpty{#1}{% - \svg@quotes@remove[{#3}]{\svg@tempb}% - \def\svg@tempa{% - Did you run the export with Inkscape? There's no file\MessageBreak% - `\filename@area\filename@base.\filename@ext'\MessageBreak% - although `\svg@tempb' was found.% - }% - }{% - \edef\filename@ext{#1}% - \Ifstr{\filename@area}{./}{\let\filename@area\@empty}{}% - \edef\svg@tempb{#3}% - \Ifstr{\svg@tempb}{./}{\let\svg@tempb\@empty}{}% - \ifx\svg@tempb\@empty% - \svg@set@input@path% - \else% - \svg@set@input@path[\svg@tempb]% - \fi% - \ifx\input@path\@undefined% - \def\svg@tempb{No additional path was given.}% - \else% - \def\svg@tempb{Following folders have additionally been searched:}% - \expandafter\@tfor\expandafter\svg@tempa\expandafter:\expandafter=% - \input@path\do{% - \edef\svg@tempb{\svg@tempb\noexpand\MessageBreak\svg@tempa}% - }% - \fi% - \def\svg@tempa{% - There's no file `\filename@base.\filename@ext'\MessageBreak% - \ifx\filename@area\@empty% - neither in the current directory nor any other searched\MessageBreak% - path given by \string\svgpath\space or \string\graphicspath.% - \MessageBreak\svg@tempb% - \else% - in folder `\filename@area'.% - \fi% - }% - }% - \PackageError{svg}{% - File `\filename@base.\filename@ext' is missing% - }{\svg@tempa}% - \endgroup% -} \newcommand*\svg@iffilenewer[2]{\@gobbletwo} \ifx\pdf@filemoddate\@undefined \ifx\filemoddate\@undefined\else @@ -991,7 +988,32 @@ }% \svg@quotes@remove[\svg@file@base]{\svg@tempa}% \svg@quotes@remove[\svg@out@name]{\svg@tempb}% - \ShellEscape{\svg@ink@cmd{\svg@tempa}{\svg@tempb}}% + \ifnum\svg@ink@ver=\m@ne\relax% + \begingroup% + \@svg@tempswafalse% + \@tfor\svg@ink@ver:={1}{0}\do{% + \ShellEscape{\svg@ink@cmd{\svg@tempa}{\svg@tempb}}% + \IfFileExists{\svg@out@name.\svg@ink@format}{% + \@svg@tempswatrue% + }{}% + \if@svg@tempswa% + \@break@tfor% + \fi% + }% + \if@svg@tempswa% + \xdef\svg@ink@ver{\svg@ink@ver}% + \else% + \PackageError{svg}{Inkscape version not detected}{% + It was tried to invoke `\svg@ink@exe'\MessageBreak% + for file "\svg@tempa.\svg@file@ext"\MessageBreak% + but no result was produced. Check the log file\MessageBreak% + and set `inkscapeversion=<version>' manually.% + }% + \fi% + \endgroup% + \else% + \ShellEscape{\svg@ink@cmd{\svg@tempa}{\svg@tempb}}% + \fi% \IfFileExists{\svg@out@name.\svg@ink@format}{% \edef\svg@tempb{\svg@tempb.\svg@ink@format}% \svg@quotes@remove{\svg@out@base}% @@ -1001,6 +1023,7 @@ \svg@shell@move{\svg@tempb_tex}{\svg@out@base_tex}% \fi% }{% + \gdef\svg@ink@ver{\m@ne}% \PackageWarning{svg}{% The export with Inkscape failed for file\MessageBreak% `\svg@tempa.\svg@file@ext'\MessageBreak% @@ -1021,65 +1044,6 @@ \endgroup% \fi% } -\newcommand*\svg@ink@cmd[2]{% - \svg@ink@exe\space-z\space\svg@ink@area\space% - \ifx\svg@ink@dpi\relax\else--export-dpi=\svg@ink@dpi\space\fi% - \if@svg@ink@latex--export-latex\space\fi% - \svg@ink@opt\space% - --file="#1.\svg@file@ext"\space% - --export-\svg@ink@format="#2.\svg@ink@format"\space% -} -\newcommand*\svg@get@lastpage[1]{% - \Ifstr{\svg@ink@format}{pdf}{% - \begingroup% - \@tempcnta=\m@ne\relax% - \ifx\XeTeXpdfpagecount\@undefined% - \ifpdf% - \ifx\pdfximage\@undefined% - \ifx\saveimageresource\@undefined\else% - \saveimageresource{#1}% - \@tempcnta=\lastsavedimageresourcepages\relax% - \fi% - \else% - \pdfximage{#1}% - \@tempcnta=\pdflastximagepages\relax% - \fi% - \fi% - \else% - \@tempcnta=\XeTeXpdfpagecount#1\relax% - \fi% - \ifnum\@tempcnta=\m@ne\relax% - \PackageWarning{svg}{% - It wasn't possible to detect the last page\MessageBreak% - of `#1'% - }% - \else% - \PackageInfo{svg}{Last page of `#1' is \the\@tempcnta}% - \fi% - \edef\svg@tempa{% - \endgroup% - \noexpand\FamilyOptions{SVG}{lastpage=\the\@tempcnta}% - }% - \svg@tempa% - }{}% -} -\newcommand*\svg@wrn@scale{% - \ifdim\dimexpr\svg@param@scale\p@\relax=\p@\relax\else% - \@svg@tempswafalse% - \ifdim\svg@param@width>\z@\relax% - \@svg@tempswatrue% - \fi% - \ifdim\svg@param@height>\z@\relax% - \@svg@tempswatrue% - \fi% - \if@svg@tempswa% - \PackageWarning{svg}{% - The parameter `scale' is only considered if neither\MessageBreak% - `width' nor `height' are specified% - }% - \fi% - \fi% -} \newcommand*\svg@input{\svg@@input} \newcommand*\svg@@input[2][]{% \IfArgIsEmpty{#1}{}{\svg@local@param@set{#1}}% @@ -1162,6 +1126,170 @@ \expandafter\includegraphics\expandafter[\svg@tempb]{\svg@tempa}% \fi% } +\newcommand*\svg@wrn@scale{% + \ifdim\dimexpr\svg@param@scale\p@\relax=\p@\relax\else% + \@svg@tempswafalse% + \ifdim\svg@param@width>\z@\relax% + \@svg@tempswatrue% + \fi% + \ifdim\svg@param@height>\z@\relax% + \@svg@tempswatrue% + \fi% + \if@svg@tempswa% + \PackageWarning{svg}{% + The parameter `scale' is only considered if neither\MessageBreak% + `width' nor `height' are specified% + }% + \fi% + \fi% +} +\newcommand*\svg@get@lastpage[1]{% + \Ifstr{\svg@ink@format}{pdf}{% + \begingroup% + \@tempcnta=\m@ne\relax% + \ifx\XeTeXpdfpagecount\@undefined% + \ifpdf% + \ifx\pdfximage\@undefined% + \ifx\saveimageresource\@undefined\else% + \saveimageresource{#1}% + \@tempcnta=\lastsavedimageresourcepages\relax% + \fi% + \else% + \pdfximage{#1}% + \@tempcnta=\pdflastximagepages\relax% + \fi% + \fi% + \else% + \@tempcnta=\XeTeXpdfpagecount#1\relax% + \fi% + \ifnum\@tempcnta=\m@ne\relax% + \PackageWarning{svg}{% + It wasn't possible to detect the last page\MessageBreak% + of `#1'% + }% + \else% + \PackageInfo{svg}{Last page of `#1' is \the\@tempcnta}% + \fi% + \edef\svg@tempa{% + \endgroup% + \noexpand\FamilyOptions{SVG}{lastpage=\the\@tempcnta}% + }% + \svg@tempa% + }{}% +} +\newcommand*\svg@file@missing[3][]{% + \begingroup% + \svg@quotes@remove[{#2}]{\svg@tempa}% + \svg@filename@parse[{#1}]{\svg@tempa}% + \IfArgIsEmpty{#1}{% + \svg@quotes@remove[{#3}]{\svg@tempb}% + \def\svg@tempa{% + Did you run the export with Inkscape? There's no file\MessageBreak% + `\filename@area\filename@base.\filename@ext'\MessageBreak% + although `\svg@tempb' was found.% + }% + }{% + \edef\filename@ext{#1}% + \Ifstr{\filename@area}{./}{\let\filename@area\@empty}{}% + \edef\svg@tempb{#3}% + \Ifstr{\svg@tempb}{./}{\let\svg@tempb\@empty}{}% + \ifx\svg@tempb\@empty% + \svg@set@input@path% + \else% + \svg@set@input@path[\svg@tempb]% + \fi% + \ifx\input@path\@undefined% + \def\svg@tempb{No additional path was given.}% + \else% + \def\svg@tempb{Following folders have additionally been searched:}% + \expandafter\@tfor\expandafter\svg@tempa\expandafter:\expandafter=% + \input@path\do{% + \edef\svg@tempb{\svg@tempb\noexpand\MessageBreak\svg@tempa}% + }% + \fi% + \def\svg@tempa{% + There's no file `\filename@base.\filename@ext'\MessageBreak% + \ifx\filename@area\@empty% + neither in the current directory nor any other searched\MessageBreak% + path given by \string\svgpath\space or \string\graphicspath.% + \MessageBreak\svg@tempb% + \else% + in folder `\filename@area'.% + \fi% + }% + }% + \PackageError{svg}{% + File `\filename@base.\filename@ext' is missing% + }{\svg@tempa}% + \endgroup% +} +\newcommand*\svg@ink@ver@settings{{\svg@ink@ver}{\svg@ink@exe}{\m@ne}} +\newif\if@svg@ink@ver@detect +\newcommand*\svg@ink@ver@detect[3]{% + \@svg@ink@ver@detectfalse% + \ifnum\pdf@shellescape=\@ne\relax% + \ifnum\svg@ink@ver=\m@ne\relax% + \svg@sanitize@dq\svg@tempa{#2}% + \ifx\svg@tempa\svg@ink@exe% + \ifnum#1>\m@ne\relax% + \@svg@ink@ver@detecttrue% + \else% + \ifnum#3=\m@ne\relax% + \@svg@ink@ver@detecttrue% + \fi% + \fi% + \else% + \@svg@ink@ver@detecttrue% + \fi% + \fi% + \fi% + \edef\svg@ink@ver@settings{% + {\svg@ink@ver}{\svg@ink@exe}{\noexpand\svg@ink@ver}% + }% + \if@svg@ink@ver@detect% + \svg@@ink@ver@detect% + \else% + \ifnum\svg@ink@ver=\m@ne\relax% + \def\svg@ink@ver{#3}% + \fi% + \fi% +} +\newcommand*\svg@@ink@ver@detect{% + \begingroup% + \@makeother\|% + \endlinechar=\m@ne% + \everyeof{\noexpand}% + \svg@quotes@remove{\svg@ink@exe}% + \edef\svg@tempa{% + \edef\noexpand\svg@tempa{\noexpand\@@input|"'\svg@ink@exe'\space-V" }% + }% + \svg@tempa% + \ifx\svg@tempa\@empty% + \ifwindows% + \def\svg@tempb{\jobname.svg.ink.ver.aux}% + \IfFileExists{\svg@tempb}{}{% + \ShellEscape{call "\svg@ink@exe" -V > \svg@tempb}% + \openin\@inputcheck=\svg@tempb% + \read\@inputcheck to\svg@tempa% + \closein\@inputcheck% + \ShellEscape{del \svg@tempb}% + }% + \fi% + \fi% + \def\svg@tempb Inkscape ##1.##2\@nil{% + \gdef\svg@ink@ver{##1}% + }% + \expandafter\svg@tempb\svg@tempa Inkscape \m@ne.\@nil% + \endgroup% +} +\AtBeginDocument{\expandafter\svg@ink@ver@detect\svg@ink@ver@settings} +\BeforeClosingMainAux{% + \if@filesw% + \immediate\write\@mainaux{% + \string\gdef\string\svg@ink@ver@settings{\svg@ink@ver@settings}% + }% + \fi% +} \newcommand*\svg@picture@saved{} \let\svg@picture@saved\picture \newcommand*\svg@includegraphics@saved{} @@ -1230,7 +1358,7 @@ \ifnum\pdf@shellescape=\@ne\relax\else% \expandafter\endinput% \fi -\RequirePackage{ifplatform}[2010/10/22] +\RequirePackage{ifplatform}[2017/10/13] \ifwindows \newcommand*\svg@shell@@mkdir[1]{if not exist "#1" mkdir "#1"} \newcommand*\svg@shell@@mv{move} |