diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/svg/svg-extract.sty | 350 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/svg/svg.sty | 846 |
2 files changed, 620 insertions, 576 deletions
diff --git a/Master/texmf-dist/tex/latex/svg/svg-extract.sty b/Master/texmf-dist/tex/latex/svg/svg-extract.sty index cb1c1fa12b3..f42fc92287d 100644 --- a/Master/texmf-dist/tex/latex/svg/svg-extract.sty +++ b/Master/texmf-dist/tex/latex/svg/svg-extract.sty @@ -4,39 +4,89 @@ %% %% The original source files were: %% +%% svg.dtx (with options: `package,identify,extract') +%% svg.dtx (with options: `package,base,extract') %% svg.dtx (with options: `package,option,extract') +%% svg.dtx (with options: `package,standalone,extract') %% svg.dtx (with options: `package,body,extract') %% %% svg-extract -- Extract independent graphic files from SVG pictures %% +%% ---------------------------------------------------------------------------- +%% %% Copyright (C) Philip Ilten <philten@cern.ch>, 2012-2016 -%% Copyright (C) Falk Hanisch <hanisch.latex@outlook.com>, 2017- -%% -%% This file was generated from file svg.dtx. +%% Copyright (C) Falk Hanisch <hanisch.latex@outlook.com>, 2017-2020 +%% %% ---------------------------------------------------------------------------- -%% +%% %% This work may be distributed and/or modified under the conditions %% of the LaTeX Project Public License, version 1.3c of the license. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.3c or later is part of all distributions of %% LaTeX 2005/12/01 or later and of this work. -%% +%% %% This work has the LPPL maintenance status "author-maintained". -%% +%% %% The current maintainer and author of this work is Falk Hanisch. -%% +%% %% This work consists of the main source file README.md, LICENSE.md, svg.dtx %% and the derived documentation svg.pdf as well as the example files %% svg-example.svg, svg-preamble.tex and root.C (with derived file root.svg). -%% -%% +%% +%% ---------------------------------------------------------------------------- +%% \NeedsTeXFormat{LaTeX2e}[2020-02-02] -\ProvidesPackage{svg-extract}[% - 2020/05/07 v2.02f\space% - (extract independent graphics from SVG pictures)% -] -\RequirePackage{svg}[2020/05/07] +\begingroup + \catcode`\@11\relax% + \def\svg@Provides#1#2[#3]{% + \def\@tempa{\def\svg@version{#3}}% + \ifx\svg@version\@undefined\else% + \def\@tempb{#3}% + \ifx\svg@version\@tempb\else% + \def\@tempa{% + \@latex@warning@no@line{% + The version of package `#1' is `#3',\MessageBreak% + but `\svg@version' was expected!\MessageBreak% + You should update the svg bundle% + }% + }% + \fi% + \fi% + \edef\@tempb{% + \endgroup% + \noexpand\ProvidesPackage% + {#1}[#3\space(#2)]% + \noexpand\RequirePackage{svg}[#3]% + \unexpanded\expandafter{\@tempa}% + }% + }% + \svg@Provides% + {svg-extract}{extract graphics from SVG pictures}% + [2020/06/12 v2.02g]% +\@tempb +\edef\svg@catcodecodes@restore{% + \catcode`\noexpand\"\the\catcode`\"\relax% +} +\@makeother\"% +\AtEndOfPackage{\svg@catcodecodes@restore} +\newcommand*\svgx@@ifkeyandval{} +\newcommand*\svgx@ifkeyandval[3]{% + \def\svgx@@ifkeyandval##1=##2=##3\@nil{\IfArgIsEmpty{##3}{#3}{#2}}% + \svgx@@ifkeyandval#1==\@nil% +} +\newcommand*\svgx@ifinlist[2]{% + \begingroup% + \def\svg@tempa##1,#1,##2\@nil{% + \IfArgIsEmpty{##2}{% + \aftergroup\@secondoftwo% + }{% + \aftergroup\@firstoftwo% + }% + }% + \expandafter\svg@tempa\expandafter,#2,#1,\@nil% + \endgroup% +} \DefineFamily{SVG} \DefineFamilyMember{SVG} \newif\if@svgx@run @@ -190,8 +240,8 @@ \FamilyKeyStateProcessed% } \DefineFamilyKey{SVG}{pdftops}{% - \PackageWarning{#1}{% - The option key `pdftops' is deprecated.\MessageBreak% + \PackageWarning{svg-extract}{% + The option key `pdftops' is deprecated. \MessageBreak% You should use either `pdftoepsopt' or\MessageBreak% `pdftopsopt' instead. See the manual for\MessageBreak% more. Nothing was done% @@ -224,17 +274,17 @@ \or% gs64 \@svgx@cnv@runtrue% \renewcommand*\svgx@cnv@cmd{\svgx@gs@cmd}% - \svgx@onlywindows{% + \svg@ifwindowsdetected{% \renewcommand*\svgx@gs@exe{gswin64c}% - }% + }{}% \or% gs32 \@svgx@cnv@runtrue% \renewcommand*\svgx@cnv@cmd{\svgx@gs@cmd}% - \svgx@onlywindows{% + \svg@ifwindowsdetected{% \renewcommand*\svgx@gs@exe{gswin32c}% - }% + }{}% \fi% - \else% + \else% legacy option \def\svg@tempa##1-##2\@nil{% \IfArgIsEmpty{##2}{\def\svg@tempb{}}{% \def\svg@tempa##1####1\@nil{\def\svg@tempb{####1}}% @@ -309,7 +359,90 @@ }% } \DefineFamilyKey{SVG}{convertdensity}{\FamilyOptions{SVG}{convertdpi=#1}} -\newcommand*\svgx@magick@exe{} +\newcommand*\svgx@cnv@get@dpi[1]{% + \begingroup% + \def\svg@tempa##1dpi##2x##3dpi##4\@nil{% + \edef\svg@tempa{##1}% + \@svg@tempswafalse% + \Ifnumber{##1}{% + \IfArgIsEmpty{##3}{\@svg@tempswatrue}{% + \Ifnumber{##3}{\edef\svg@tempa{##1x##3}}{}% + }% + }{}% + \if@svg@tempswa\else% + \expandafter\svg@tempb\svg@tempa xx\@nil% + \fi% + }% + \def\svg@tempb##1x##2x##3\@nil{% + \Ifstr{##3}{x}{% + \@svg@tempswatrue% + \IfArgIsEmpty{##1}{\@svg@tempswafalse}{% + \Ifnumber{##1}{}{\@svg@tempswafalse}% + }% + \IfArgIsEmpty{##2}{\@svg@tempswafalse}{% + \Ifnumber{##2}{}{\@svg@tempswafalse}% + }% + \if@svg@tempswa% + \edef\svg@tempa{##1x##2}% + \fi% + }{}% + }% + \IfArgIsEmpty{#1}{% + \let\svg@tempa\@empty% + }{% + \lowercase{\svg@tempa#1dpi#1xdpi\@nil}% + \if@svg@tempswa\else% + \let\svg@tempa\relax% + \fi% + }% + \edef\svg@tempb{% + \endgroup% + \ifx\svg@tempa\relax% + \let\noexpand\svg@tempa\noexpand\relax% + \else% + \def\noexpand\svg@tempa{\svg@tempa}% + \fi% + }% + \svg@tempb% +} +\newcommand*\svgx@setformatkey[2]{% + \svgx@ifkeyandval{#1}{% + \svg@ifvalueisrelax{##2}{% + \expandafter\let\csname #2@##1\endcsname\relax% + }{% + \@namedef{#2@##1}{##2}% + }% + }{% + \svg@ifvalueisrelax{##1}{% + \expandafter\let\csname #2\endcsname\relax% + }{% + \@namedef{#2}{##1}% + }% + }% +} +\newcommand*\svgx@useformatkey[3]{% + \scr@ifundefinedorrelax{#1@#2}{% + \scr@ifundefinedorrelax{#1}{}{% + \expandafter\ifx\csname #1\endcsname\@empty\else% + #3\@nameuse{#1}\space% + \fi% + }% + \scr@ifundefinedorrelax{#1@#2+}{}{% + \expandafter\ifx\csname #1@#2+\endcsname\@empty\else% + #3\@nameuse{#1@#2+}\space% + \fi% + }% + }{% + \expandafter\ifx\csname #1@#2\endcsname\@empty\else% + #3\@nameuse{#1@#2}\space% + \fi% + }% +} +\svg@ifwindowsdetected{% + \newcommand*\svgx@magick@exe{magick}% +}{% + \newcommand*\svgx@magick@exe{convert}% +} \DefineFamilyKey{SVG}{magickexe}{% \renewcommand*\svgx@magick@exe{#1}% \FamilyKeyStateProcessed% @@ -324,7 +457,19 @@ \svgx@setformatkey{#1}{svgx@magick@opr}% \FamilyKeyStateProcessed% } -\newcommand*\svgx@gs@exe{} +\newcommand*\svgx@magick@cmd[3]{% + \svgx@magick@exe\space% + \svgx@useformatkey{svgx@cnv@dpi}{#3}{-density }% + \svgx@useformatkey{svgx@magick@set}{#3}{}% + "#1.#2"\space% + \svgx@useformatkey{svgx@magick@opr}{#3}{}% + "#1.#3"% +} +\svg@ifwindowsdetected{% + \newcommand*\svgx@gs@exe{gswin64c}% +}{% + \newcommand*\svgx@gs@exe{gs}% +} \DefineFamilyKey{SVG}{gsexe}{% \renewcommand*\svgx@gs@exe{#1}% \FamilyKeyStateProcessed% @@ -339,6 +484,13 @@ \svgx@setformatkey{#1}{svgx@gs@device}% \FamilyKeyStateProcessed% } +\newcommand*\svgx@gs@cmd[3]{% + \svgx@gs@exe\space-dSAFER -dBATCH -dNOPAUSE\space% + \svgx@useformatkey{svgx@gs@device}{#3}{-sDEVICE=}% + \svgx@useformatkey{svgx@cnv@dpi}{#3}{-r}% + \svgx@useformatkey{svgx@gs@opt}{#3}{}% + -sOutputFile="#1.#3"\space"#1.#2"% +} \newcommand*\svgx@out@path{} \DefineFamilyKey{SVG}{extractpath}{% \svg@sanitize@dq\svg@tempb{#1}% @@ -367,9 +519,10 @@ \DefineFamilyKey{SVG}{path}{% \svg@deprecated@key[svg-extract]{path=#1}{extractpath=#1}% } -\newcounter{svgx@out@count} \newcommand*\svgx@out@name{} \newif\if@svgx@out@sec +\newcounter{svgx@out@count} +\newcommand*\svgx@out@sec{unknown} \DefineFamilyKey{SVG}{extractname}{% \svg@quotes@remove[{#1}]{\svg@tempb}% \FamilySetNumerical{SVG}{extractname}{svg@tempa}{% @@ -460,7 +613,7 @@ \ifx\FamilyKeyState\FamilyKeyStateProcessed% \if@svg@tempswa% \FamilyOptions{SVG}{extractdistort=false}% - \else + \else% \FamilyOptions{SVG}{extractdistort=true}% \fi% \else% @@ -530,7 +683,7 @@ \FamilyKeyStateProcessed% \fi% } -\DefineFamilyKey{SVG}{clear}{\FamilyOptions{SVG}{clean=#1}} +\DefineFamilyKey{SVG}{clear}[true]{\FamilyOptions{SVG}{clean=#1}} \DefineFamilyKey{SVG}{exclude}[true]{% \FamilySetBool{SVG}{exclude}{@svg@tempswa}{#1}% \ifx\FamilyKeyState\FamilyKeyStateProcessed% @@ -548,103 +701,15 @@ \fi% \fi% } -\newcommand*\svgx@ifinlist[2]{% - \begingroup% - \def\svg@tempa##1,#1,##2\@nil{% - \IfArgIsEmpty{##2}{% - \aftergroup\@secondoftwo% - }{% - \aftergroup\@firstoftwo% - }% - }% - \expandafter\svg@tempa\expandafter,#2,#1,\@nil% - \endgroup% -} -\newcommand*\svgx@onlywindows[1]{} -\AfterPackage*{ifplatform}{\renewcommand*\svgx@onlywindows[1]{\ifwindows#1\fi}} -\newcommand*\svgx@ifkeyandval[3]{% - \def\svg@tempa##1=##2=##3\@nil{\Ifstr{##3}{=}{#2}{#3}}% - \svg@tempa#1==\@nil% -} -\newcommand*\svgx@cnv@get@dpi[1]{% - \begingroup% - \def\svg@tempa##1dpi##2x##3dpi##4\@nil{% - \edef\svg@tempa{##1}% - \@svg@tempswafalse% - \Ifnumber{##1}{% - \IfArgIsEmpty{##3}{\@svg@tempswatrue}{% - \Ifnumber{##3}{\edef\svg@tempa{##1x##3}}{}% - }% - }{}% - \if@svg@tempswa\else% - \expandafter\svg@tempb\svg@tempa xx\@nil% - \fi% - }% - \def\svg@tempb##1x##2x##3\@nil{% - \Ifstr{##3}{x}{% - \@svg@tempswatrue% - \IfArgIsEmpty{##1}{\@svg@tempswafalse}{% - \Ifnumber{##1}{}{\@svg@tempswafalse}% - }% - \IfArgIsEmpty{##2}{\@svg@tempswafalse}{% - \Ifnumber{##2}{}{\@svg@tempswafalse}% - }% - \if@svg@tempswa% - \edef\svg@tempa{##1x##2}% - \fi% - }{}% - }% - \IfArgIsEmpty{#1}{% - \let\svg@tempa\@empty% - }{% - \lowercase{\svg@tempa#1dpi#1xdpi\@nil}% - \if@svg@tempswa\else% - \let\svg@tempa\relax% - \fi% - }% - \edef\svg@tempb{% - \endgroup% - \ifx\svg@tempa\relax% - \let\noexpand\svg@tempa\noexpand\relax% - \else% - \def\noexpand\svg@tempa{\svg@tempa}% - \fi% - }% - \svg@tempb% -} -\newcommand*\svgx@setformatkey[2]{% - \svgx@ifkeyandval{#1}{% - \svg@ifvalueisrelax{##2}{% - \expandafter\let\csname #2@##1\endcsname\relax% - }{% - \@namedef{#2@##1}{##2}% - }% - }{% - \svg@ifvalueisrelax{##1}{% - \expandafter\let\csname #2\endcsname\relax% - }{% - \@namedef{#2}{##1}% - }% - }% -} -\newcommand*\svgx@useformatkey[3]{% - \scr@ifundefinedorrelax{#1@#2}{% - \scr@ifundefinedorrelax{#1}{}{% - \expandafter\ifx\csname #1\endcsname\@empty\else% - #3\@nameuse{#1}\space% - \fi% - }% - \scr@ifundefinedorrelax{#1@#2+}{}{% - \expandafter\ifx\csname #1@#2+\endcsname\@empty\else% - #3\@nameuse{#1@#2+}\space% - \fi% - }% - }{% - \expandafter\ifx\csname #1@#2\endcsname\@empty\else% - #3\@nameuse{#1@#2}\space% - \fi% - }% +\FamilyExecuteOptions{SVG}{% + extract=true,extractpath=basesubdir,% + extractruns=2,extractname=namenumbered,extractdistort=false,% + convert=magick,convert=false,% + gsdevice={png=png16m},gsdevice={jpeg=jpeg},gsdevice={jpg=jpeg},% + gsdevice={tif=tiff48nc},gsdevice={tiff=tiff48nc},% + gsdevice={eps=eps2write},gsdevice={ps=ps2write}% } +\FamilyProcessOptions{SVG} \newif\if@svgx@standalone \newcommand*\svgxsetbox[2][]{% \@svgx@standalonetrue% @@ -709,15 +774,6 @@ \endgraf% \endgroup% } -\FamilyExecuteOptions{SVG}{% - extract=true,extractpath=basesubdir,% - extractruns=2,extractname=namenumbered,extractdistort=false,% - convert=magick,convert=false,% - gsdevice={png=png16m},gsdevice={jpeg=jpeg},gsdevice={jpg=jpeg},% - gsdevice={tif=tiff48nc},gsdevice={tiff=tiff48nc},% - gsdevice={eps=eps2write},gsdevice={ps=ps2write}% -} -\FamilyProcessOptions{SVG} \DefineFamilyMember[.param]{SVG} \newcommand*\svgx@param@angle{0} \svg@local@param@def{% @@ -1063,7 +1119,6 @@ }% \fi% } -\newcommand*\svgx@out@sec{unknown} \newcommand*\svgx@get@out@sec{% \begingroup% \def\svg@tempa{}% @@ -1147,39 +1202,10 @@ \fi\fi% \fi% } -\ifx\svgx@magick@exe\@empty - \ifwindows - \renewcommand*\svgx@magick@exe{magick} - \else - \renewcommand*\svgx@magick@exe{convert} - \fi -\fi -\newcommand*\svgx@magick@cmd[3]{% - \svgx@magick@exe\space% - \svgx@useformatkey{svgx@cnv@dpi}{#3}{-density }% - \svgx@useformatkey{svgx@magick@set}{#3}{}% - "#1.#2"\space% - \svgx@useformatkey{svgx@magick@opr}{#3}{}% - "#1.#3"% -} -\ifx\svgx@gs@exe\@empty - \ifwindows - \renewcommand*\svgx@gs@exe{gswin64c} - \else - \renewcommand*\svgx@gs@exe{gs} - \fi -\fi -\newcommand*\svgx@gs@cmd[3]{% - \svgx@gs@exe\space-dSAFER -dBATCH -dNOPAUSE\space% - \svgx@useformatkey{svgx@gs@device}{#3}{-sDEVICE=}% - \svgx@useformatkey{svgx@cnv@dpi}{#3}{-r}% - \svgx@useformatkey{svgx@gs@opt}{#3}{}% - -sOutputFile="#1.#3"\space"#1.#2"% -} \newcommand*\svgx@move[3]{% \begingroup% \IfFileExists{"#1".#2}{% - \svg@shell@move{#1.#2}{#3#1.#2}% + \svg@shell@mv{#1.#2}{#3#1.#2}% }{% \edef\svg@tempa{#2}% \@svg@tempswafalse% diff --git a/Master/texmf-dist/tex/latex/svg/svg.sty b/Master/texmf-dist/tex/latex/svg/svg.sty index 826e8a23b19..0f11773f8a9 100644 --- a/Master/texmf-dist/tex/latex/svg/svg.sty +++ b/Master/texmf-dist/tex/latex/svg/svg.sty @@ -4,57 +4,321 @@ %% %% The original source files were: %% -%% svg.dtx (with options: `package,option,base') -%% svg.dtx (with options: `package,body,base') +%% svg.dtx (with options: `package,identify,main') +%% svg.dtx (with options: `package,base,main') +%% svg.dtx (with options: `package,option,main') +%% svg.dtx (with options: `package,body,main') %% %% svg -- Include SVG pictures in LaTeX documents using Inkscape %% +%% ---------------------------------------------------------------------------- +%% %% Copyright (C) Philip Ilten <philten@cern.ch>, 2012-2016 -%% Copyright (C) Falk Hanisch <hanisch.latex@outlook.com>, 2017- -%% -%% This file was generated from file svg.dtx. +%% Copyright (C) Falk Hanisch <hanisch.latex@outlook.com>, 2017-2020 +%% %% ---------------------------------------------------------------------------- -%% +%% %% This work may be distributed and/or modified under the conditions %% of the LaTeX Project Public License, version 1.3c of the license. %% The latest version of this license is in %% http://www.latex-project.org/lppl.txt %% and version 1.3c or later is part of all distributions of %% LaTeX 2005/12/01 or later and of this work. -%% +%% %% This work has the LPPL maintenance status "author-maintained". -%% +%% %% The current maintainer and author of this work is Falk Hanisch. -%% +%% %% This work consists of the main source file README.md, LICENSE.md, svg.dtx %% and the derived documentation svg.pdf as well as the example files %% svg-example.svg, svg-preamble.tex and root.C (with derived file root.svg). -%% -%% +%% +%% ---------------------------------------------------------------------------- +%% \NeedsTeXFormat{LaTeX2e}[2020-02-02] -\ProvidesPackage{svg}[% - 2020/05/07 v2.02f\space% - (include SVG pictures)% -] +\begingroup + \catcode`\@11\relax% + \def\svg@Provides#1#2[#3]{% + \def\@tempa{\def\svg@version{#3}}% + \ifx\svg@version\@undefined\else% + \def\@tempb{#3}% + \ifx\svg@version\@tempb\else% + \def\@tempa{% + \@latex@warning@no@line{% + The version of package `#1' is `#3',\MessageBreak% + but `\svg@version' was expected!\MessageBreak% + You should update the svg bundle% + }% + }% + \fi% + \fi% + \edef\@tempb{% + \endgroup% + \noexpand\ProvidesPackage% + {#1}[#3\space(#2)]% + \unexpanded\expandafter{\@tempa}% + }% + }% + \svg@Provides% + {svg}{include SVG pictures}% + [2020/06/12 v2.02g]% +\@tempb \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}[2019/11/30] -\newcommand*\svg@tempa{} -\newcommand*\svg@tempb{} -\newbox\svg@box -\newif\if@svg@tempswa +\RequirePackage{shellesc}[2019/11/08] +\ifnum\pdf@shellescape=\@ne\relax + \RequirePackage{ifplatform}[2017/10/13] +\fi \edef\svg@catcodecodes@restore{% \catcode`\noexpand\"\the\catcode`\"\relax% } \@makeother\"% +\AtEndOfPackage{\svg@catcodecodes@restore} +\newcommand*\svg@tempa{} +\newcommand*\svg@tempb{} +\newif\if@svg@tempswa +\newcommand*\svg@ifwindowsdetected{\@secondoftwo} +\AfterPackage*{ifplatform}{% + \renewcommand*\svg@ifwindowsdetected{% + \ifwindows% + \expandafter\@firstoftwo% + \else% + \expandafter\@secondoftwo% + \fi% + }% +} +\newcommand*\svg@ifvalueisrelax[1]{% + \begingroup% + \def\svg@tempa{#1}% + \def\svg@tempb{\relax}% + \ifx\svg@tempa\svg@tempb% + \aftergroup\@firstoftwo% + \else% + \aftergroup\@secondoftwo% + \fi% + \endgroup% +} +\newcommand*\svg@deactivate@dq{} +\AfterPackage+{babel}{% + \renewcommand*\svg@deactivate@dq{\bbl@deactivate{"}}% + \providecommand*\bbl@deactivate[1]{}% +} +\newcommand*\svg@sanitize@dq[2]{% + \begingroup% + \svg@deactivate@dq% + \edef\svg@tempa{\endgroup\def\noexpand#1{#2}}% + \svg@tempa% +} +\newif\if@svg@quotes@found +\newcommand*\svg@quotes@check[1]{% + \expandafter\svg@quotes@@check#1"\@nil% +} +\newcommand*\svg@quotes@@check{} +\def\svg@quotes@@check#1"#2\@nil{% + \IfArgIsEmpty{#2}{\@svg@quotes@foundfalse}{\@svg@quotes@foundtrue}% +} +\newcommand*\svg@quotes@remove[2][]{% + \begingroup% + \IfArgIsEmpty{#1}{\def\svg@tempb{#2}}{\def\svg@tempb{#1}}% + \svg@sanitize@dq\svg@tempa{\svg@tempb}% + \expandafter\svg@quotes@check\expandafter{\svg@tempa}% + \expandafter\svg@quotes@@remove\svg@tempa""\@nil% + \edef\svg@tempb{% + \endgroup% + \def\noexpand#2{\svg@tempa}% + \if@svg@quotes@found% + \noexpand\@svg@quotes@foundtrue% + \else% + \noexpand\@svg@quotes@foundfalse% + \fi% + }% + \svg@tempb% +} +\newcommand*\svg@quotes@@remove{} +\def\svg@quotes@@remove#1"#2"#3\@nil{% + \IfArgIsEmpty{#2}{% + \edef\svg@tempa{#1}% + }{% + \svg@quotes@@remove#1#2#3""\@nil% + }% +} +\newcommand*\svg@remove@leadingchar[2]{% + \begingroup% + \svg@sanitize@dq\svg@tempa{#2}% + \def\svg@tempb{% + \def\svg@tempa####1\@nil{\def\svg@tempa{####1}}% + \kernel@ifnextchar#1% + {\expandafter\svg@tempa\@gobble}% + {\svg@tempa}% + }% + \expandafter\svg@tempb\svg@tempa\@nil% + \edef\svg@tempb{% + \endgroup% + \def\noexpand#2{\svg@tempa}% + }% + \svg@tempb% +} +\newcommand*\svg@filename@parse[2][]{% + \begingroup% + \svg@sanitize@dq\svg@tempa{#2}% + \expandafter\filename@parse\expandafter{\svg@tempa}% + \svg@quotes@remove{\filename@area}% + \if@svg@quotes@found% + \edef\filename@area{"\filename@area"}% + \svg@remove@leadingchar"\filename@base% + \fi% + \ifx\filename@ext\relax\else% + \svg@quotes@remove{\filename@ext}% + \svg@extension@parse{#1}% + \if@svg@quotes@found% + \edef\filename@base{\filename@base"}% + \fi% + \fi% + \svg@quotes@remove{\filename@base}% + \if@svg@quotes@found% + \edef\filename@base{"\filename@base"}% + \fi% + \edef\svg@tempa{% + \endgroup% + \def\noexpand\filename@area{\filename@area}% + \def\noexpand\filename@base{\filename@base}% + \ifx\filename@ext\relax% + \let\noexpand\filename@ext\noexpand\relax% + \else% + \def\noexpand\filename@ext{\filename@ext}% + \fi% + }% + \svg@tempa% +} +\newcommand*\svg@extension@parse[1]{% + \IfArgIsEmpty{#1}{}{% + \@expandtwoargs\Ifstr% + {\detokenize\expandafter{\filename@ext}}{\detokenize\expandafter{#1}}{}{% + \begingroup% + \edef\svg@tempa{% + \def\noexpand\svg@tempa{}% + \let\noexpand\svg@tempb\relax% + \noexpand\svg@extension@@parse% + \filename@ext.\noexpand\@nil#1\noexpand\@nil% + }% + \svg@tempa% + \edef\svg@tempa{% + \endgroup% + \def\noexpand\filename@base{\filename@base\svg@tempa}% + \ifx\svg@tempb\relax% + \let\noexpand\filename@ext\relax% + \else% + \def\noexpand\filename@ext{\svg@tempb}% + \fi% + }% + \svg@tempa% + }% + }% +} +\newcommand*\svg@extension@@parse{} +\def\svg@extension@@parse#1.#2\@nil#3\@nil{% + \edef\svg@tempa{\svg@tempa.#1}% + \IfArgIsEmpty{#2}{}{% + \Ifstr{\detokenize{#2}}{\detokenize{#3.}}{% + \edef\svg@tempb{#3}% + }{% + \svg@extension@@parse#2\@nil#3\@nil% + }% + }% +} +\newcommand*\svg@iffilenewer[2]{\@gobbletwo} +\ifx\pdf@filemoddate\@undefined + \ifx\filemoddate\@undefined\else + \ifx\strcmp\@undefined\else + \renewcommand*\svg@iffilenewer[2]{% + \begingroup% + \edef\svg@tempa{\filemoddate{#1}}% + \edef\svg@tempb{\filemoddate{#2}}% + \ifnum\strcmp{\svg@tempa}{\svg@tempb}>\z@\relax% + \aftergroup\@firstoftwo% + \else% + \aftergroup\@secondoftwo% + \fi% + \endgroup% + }% + \fi + \fi +\else + \ifx\pdf@strcmp\@undefined\else + \renewcommand*\svg@iffilenewer[2]{% + \begingroup% + \edef\svg@tempa{\pdf@filemoddate{#1}}% + \edef\svg@tempb{\pdf@filemoddate{#2}}% + \ifnum\pdf@strcmp{\svg@tempa}{\svg@tempb}>\z@\relax% + \aftergroup\@firstoftwo% + \else% + \aftergroup\@secondoftwo% + \fi% + \endgroup% + }% + \fi +\fi +\newcommand*\svg@shell@mkdir[1]{% + \begingroup% + \svg@quotes@remove[{#1}]{\svg@tempa}% + \@svg@tempswatrue% + \Ifstr{\svg@tempa}{}{\@svg@tempswafalse}{% + \Ifstr{\svg@tempa}{./}{\@svg@tempswafalse}{% + }}% + \if@svg@tempswa% + \ShellEscape{\svg@shell@@mkdir{\svg@tempa}}% + \fi% + \endgroup% +} +\newcommand*\svg@shell@mv[2]{% + \ShellEscape{\svg@shell@@mv\space"#1"\space"#2"}% +} +\newcommand*\svg@shell@rm[1]{% + \ShellEscape{\svg@shell@@rm\space"#1"}% +} +\svg@ifwindowsdetected{% + \newcommand*\svg@shell@@mkdir[1]{if not exist "#1" mkdir "#1"}% + \newcommand*\svg@shell@@mv{move}% + \newcommand*\svg@shell@@rm{del}% +}{% + \newcommand*\svg@shell@@mkdir[1]{mkdir -p "#1"}% + \newcommand*\svg@shell@@mv{mv}% + \newcommand*\svg@shell@@rm{rm}% +} +\newcommand*\svg@normalize@path[1]{% + \begingroup% + \svg@quotes@remove[{#1}]{\svg@tempa}% + \ifx\svg@tempa\@empty\relax% + \def\svg@tempa{./}% + \fi% + \expandafter\svg@normalize@@path\svg@tempa//\@nil% + \edef\svg@tempb{% + \endgroup% + \if@svg@quotes@found% + \def\noexpand#1{"\svg@tempa"}% + \else% + \def\noexpand#1{\svg@tempa}% + \fi% + }% + \svg@tempb% +} +\newcommand*\svg@normalize@@path{} +\def\svg@normalize@@path#1/#2/\@nil{% + \IfArgIsEmpty{#2}{% + \IfArgIsEmpty{#1}{\def\svg@tempa{}}{\def\svg@tempa{#1/}}% + }{% + \svg@normalize@@path#2/\@nil% + \edef\svg@tempa{#1/\svg@tempa}% + }% +} \DefineFamily{SVG} \DefineFamilyMember{SVG} \newcommand*\svg@deprecated@key[3][svg]{% \PackageWarning{#1}{% - The option key `#2' is deprecated.\MessageBreak% + The option key `#2' is deprecated. \MessageBreak% It's recommended to use `#3'\MessageBreak% instead% }% @@ -83,15 +347,18 @@ \PackageWarning{svg}{Package `transparent' was loaded anyway}% }% \fi% + \AfterPackage*{transparent}{% + \@ifpackagelater{transparent}{2018/11/19}{}{\RequirePackage{pgfsys}}% + }% } \newcommand*\svg@ink@mode{} \DefineFamilyKey{SVG}{inkscape}[true]{% - \lowercase{\svg@sanitize@dq\svg@tempb{#1}}% + \svg@sanitize@dq\svg@tempb{#1}% \FamilySetNumerical{SVG}{inkscape}{svg@tempa}{% {false}{0},{off}{0},{no}{0},% - {true}{1},{on}{1},{yes}{1},{onlynewer}{1},{newer}{1},% - {force}{2},{forced}{2},{overwrite}{2},% - {pdf}{3},{eps}{4},{ps}{5},{png}{6},% + {true}{1},{on}{1},{yes}{1},{auto}{1},{onlynewer}{1},{newer}{1},% + {forced}{2},{force}{2},{overwrite}{2},% + {pdf}{3},{PDF}{3},{eps}{4},{EPS}{4},{ps}{5},{PS}{5},{png}{6},{PNG}{6},% {drawing}{7},{crop}{7},% {page}{8},{nocrop}{8},% {tex}{9},{latex}{9},{exportlatex}{9},{latexexport}{9},% @@ -125,10 +392,10 @@ \Ifstr{##2}{dpi}{\FamilyOptions{SVG}{inkscapedpi=##1}}{}% }% \lowercase{\expandafter\svg@tempa\svg@tempb dpi\@nil}% - \ifx\FamilyKeyState\FamilyKeyStateProcessed\else% + \ifx\FamilyKeyState\FamilyKeyStateProcessed\else% legacy option \svg@quotes@remove[{#1}]{\svg@tempb}% \def\svg@tempa##1-##2\@nil{% - \IfArgIsEmpty{##2}{\def\svg@tempb{}}{% + \IfArgIsEmpty{##2}{\let\svg@tempb\@empty}{% \def\svg@tempa####1-\@nil{\def\svg@tempb{-####1}}% \svg@tempa##2\@nil% }% @@ -212,10 +479,9 @@ \renewcommand*\svg@ink@format{eps} \fi\fi \DefineFamilyKey{SVG}{inkscapeformat}{% - \lowercase{\def\svg@tempa{#1}}% \FamilySetNumerical{SVG}{inkscapeformat}{svg@tempa}{% - {pdf}{0},{eps}{1},{ps}{2},{png}{3}% - }{\svg@tempa}% + {pdf}{0},{PDF}{0},{eps}{1},{EPS}{1},{ps}{2},{PS}{2},{png}{3},{PNG}{3}% + }{#1}% \ifx\FamilyKeyState\FamilyKeyStateProcessed% \ifcase\svg@tempa\relax% latex \renewcommand*\svg@ink@format{pdf}% @@ -295,8 +561,6 @@ \DefineFamilyKey{SVG}{extension}{\FamilyOptions{SVG}{svgextension=#1}} \DefineFamilyKey{SVG}{ext}{\FamilyOptions{SVG}{svgextension=#1}} \newcommand*\svg@out@path{} -\newcommand*\svg@out@name{\svg@file@name\svg@file@suffix} -\newcommand*\svg@out@base{\svg@out@path\svg@out@name.\svg@ink@format} \DefineFamilyKey{SVG}{inkscapepath}{% \svg@sanitize@dq\svg@tempb{#1}% \FamilySetNumerical{SVG}{inkscapepath}{svg@tempa}{% @@ -321,6 +585,8 @@ \FamilyKeyStateProcessed% \fi% } +\newcommand*\svg@out@name{\svg@file@name\svg@file@suffix} +\newcommand*\svg@out@base{\svg@out@path\svg@out@name.\svg@ink@format} \DefineFamilyKey{SVG}{inkscapename}{% \renewcommand*\svg@out@name{#1\svg@file@suffix}% \FamilyKeyStateProcessed% @@ -361,9 +627,9 @@ \FamilySetBool{SVG}{keepaspectratio}{@svg@tempswa}{#1}% \ifx\FamilyKeyState\FamilyKeyStateProcessed% \if@svg@tempswa% - \FamilyOptions{SVG}{distort=false}% - \else - \FamilyOptions{SVG}{distort=true}% + \FamilyExecuteOptions[.svg.sty]{SVG}{distort=false}% + \else% + \FamilyExecuteOptions[.svg.sty]{SVG}{distort=true}% \fi% \fi% } @@ -406,7 +672,7 @@ \svg@deprecated@key{postex=#1}{apptex=#1}% } \newcounter{svg@param@lastpage} -\DefineFamilyKey{SVG}{lastpage}{% +\DefineFamilyKey{SVG}{lastpage}[true]{% \FamilySetNumerical{SVG}{lastpage}{svg@tempa}{% {false}{0},{off}{0},{no}{0},{ignore}{0},% {true}{1},{on}{1},{yes}{1},{auto}{1}% @@ -421,145 +687,7 @@ } \newif\if@svg@draft \FamilyBoolKey{SVG}{draft}{@svg@draft} -\AtBeginDocument{\if@svg@draft\else\ifGin@draft\@svg@drafttrue\fi\fi} -\newcommand*\svg@deactivate@dq{} -\AfterPackage+{babel}{% - \renewcommand*\svg@deactivate@dq{\bbl@deactivate{"}}% - \providecommand*\bbl@deactivate[1]{}% -} -\newcommand*\svg@sanitize@dq[2]{% - \begingroup% - \svg@deactivate@dq% - \edef\svg@tempa{\endgroup\def\noexpand#1{#2}}% - \svg@tempa% -} -\newcommand*\svg@quotes@remove[2][]{% - \begingroup% - \IfArgIsEmpty{#1}{\def\svg@tempb{#2}}{\def\svg@tempb{#1}}% - \svg@sanitize@dq\svg@tempa{\svg@tempb}% - \expandafter\svg@quotes@check\expandafter{\svg@tempa}% - \expandafter\svg@quotes@@remove\svg@tempa""\@nil% - \edef\svg@tempb{% - \endgroup% - \def\noexpand#2{\svg@tempa}% - \if@svg@quotes@found% - \noexpand\@svg@quotes@foundtrue% - \else% - \noexpand\@svg@quotes@foundfalse% - \fi% - }% - \svg@tempb% -} -\newcommand*\svg@quotes@@remove{} -\def\svg@quotes@@remove#1"#2"#3\@nil{% - \IfArgIsEmpty{#2}{% - \edef\svg@tempa{#1}% - }{% - \svg@quotes@@remove#1#2#3""\@nil% - }% -} -\newif\if@svg@quotes@found -\newcommand*\svg@quotes@check[1]{% - \expandafter\svg@quotes@@check#1"\@nil% -} -\newcommand*\svg@quotes@@check{} -\def\svg@quotes@@check#1"#2\@nil{% - \IfArgIsEmpty{#2}{\@svg@quotes@foundfalse}{\@svg@quotes@foundtrue}% -} -\newcommand*\svg@remove@leadingchar[2]{% - \begingroup% - \svg@sanitize@dq\svg@tempa{#2}% - \def\svg@tempb{% - \def\svg@tempa####1\@nil{\def\svg@tempa{####1}}% - \kernel@ifnextchar#1% - {\expandafter\svg@tempa\@gobble}% - {\svg@tempa}% - }% - \expandafter\svg@tempb\svg@tempa\@nil% - \edef\svg@tempb{% - \endgroup% - \def\noexpand#2{\svg@tempa}% - }% - \svg@tempb% -} -\newcommand*\svg@set@input@path[1][]{% - \begingroup% - \svg@deactivate@dq% - \ifx\svg@file@path\@empty\else% - \svg@normalize@path{\svg@file@path}% - \edef\svg@file@path{{\svg@file@path}}% - \fi% - \svg@append@input@path{\svg@file@path}{\svg@input@path}% - \svg@append@input@path{\svg@file@path}{\Ginput@path}% - \IfArgIsEmpty{#1}{}{\svg@append@input@path{\svg@file@path}{{#1}}}% - \svg@append@input@path{\svg@file@path}{\input@path}% - \edef\svg@tempa{% - \endgroup% - \ifx\svg@file@path\@empty\else% - \def\noexpand\input@path{\svg@file@path}% - \fi% - }% - \svg@tempa% -} -\newcommand*\svg@append@input@path[2]{% - \ifx#2\@undefined\else% - \edef\svg@tempb{#2}% - \expandafter\@tfor\expandafter\svg@tempa\expandafter:\expandafter=% - \svg@tempb\do{% - \ifx\svg@tempa\@empty\else% - \@svg@tempswatrue% - \svg@normalize@path{\svg@tempa}% - \expandafter\@tfor\expandafter\svg@tempb\expandafter:\expandafter=% - #1\do{% - \ifx\svg@tempa\svg@tempb% - \@svg@tempswafalse% - \@break@tfor% - \fi% - }% - \if@svg@tempswa% - \edef#1{#1{\svg@tempa}}% - \fi% - \fi% - }% - \fi% -} -\newcommand*\svg@normalize@path[1]{% - \begingroup% - \svg@quotes@remove[{#1}]{\svg@tempa}% - \ifx\svg@tempa\@empty\relax% - \def\svg@tempa{./}% - \fi% - \expandafter\svg@normalize@@path\svg@tempa//\@nil% - \edef\svg@tempb{% - \endgroup% - \if@svg@quotes@found% - \def\noexpand#1{"\svg@tempa"}% - \else% - \def\noexpand#1{\svg@tempa}% - \fi% - }% - \svg@tempb% -} -\newcommand*\svg@normalize@@path{} -\def\svg@normalize@@path#1/#2/\@nil{% - \IfArgIsEmpty{#2}{% - \IfArgIsEmpty{#1}{\def\svg@tempa{}}{\def\svg@tempa{#1/}}% - }{% - \svg@normalize@@path#2/\@nil% - \edef\svg@tempa{#1/\svg@tempa}% - }% -} -\newcommand*\svg@ifvalueisrelax[1]{% - \begingroup% - \def\svg@tempa{#1}% - \def\svg@tempb{\relax}% - \ifx\svg@tempa\svg@tempb\relax% - \aftergroup\@firstoftwo% - \else% - \aftergroup\@secondoftwo% - \fi% - \endgroup% -} +\AfterPackage*{graphicx}{\ifGin@draft\@svg@drafttrue\fi} \DefineFamilyMember[.dummy]{SVG} \newcommand*\svg@dummy@key[2][]{% \@ifpackageloaded{svg-extract}{}{% @@ -631,170 +759,52 @@ \svg@dummy@key[true]{clear} \svg@dummy@key[true]{exclude} \FamilyExecuteOptions{SVG}{% - inkscape=true,inkscapeversion=auto,inkscapepath=basesubdir, + inkscape=true,inkscapeversion=auto,inkscapepath=basesubdir,% inkscapelatex=true,inkscapearea=drawing,distort=false,% usexcolor=true,usetransparent=true% } \FamilyProcessOptions{SVG} -\newif\if@svg@file@found -\newcommand*\svg@file@path{} -\newcommand*\svg@file@name{} -\newcommand*\svg@file@base{} -\newcommand*\svg@file@suffix{} -\newcommand*\svg@get@path[3][\svg@file@ext]{% - \begingroup% - \svg@filename@parse[{#1}]{#2}% - \IfArgIsEmpty{#1}{% - \edef\svg@tempa{\filename@area\filename@base.\filename@ext}% - }{% - \edef\svg@tempa{\filename@area\filename@base.#1}% - }% - \svg@set@input@path[{#3}]% - \@svg@tempswafalse% - \expandafter\IfFileExists\expandafter{\svg@tempa}{% - \expandafter\svg@quotes@check\expandafter{\svg@tempa}% - \if@svg@quotes@found\else% - \svg@quotes@remove{\@filef@und}% - \fi% - \@svg@tempswatrue% - \edef\@filef@und{\expandafter\trim@spaces\expandafter{\@filef@und}}% - \svg@filename@parse[{#1}]{\@filef@und}% - }{}% - \edef\svg@tempa{% - \endgroup% - \if@svg@tempswa% - \noexpand\@svg@file@foundtrue% - \def\noexpand\svg@file@path{\filename@area}% - \def\noexpand\svg@file@name{\filename@base}% - \def\noexpand\svg@file@base{\filename@area\filename@base}% - \else% - \noexpand\@svg@file@foundfalse% - \def\noexpand\svg@file@path{}% - \def\noexpand\svg@file@name{#2}% - \def\noexpand\svg@file@base{#2}% - \fi% - }% - \svg@tempa% -} -\newcommand*\svg@filename@parse[2][]{% - \begingroup% - \svg@sanitize@dq\svg@tempa{#2}% - \expandafter\filename@parse\expandafter{\svg@tempa}% - \svg@quotes@remove{\filename@area}% - \if@svg@quotes@found% - \edef\filename@area{"\filename@area"}% - \svg@remove@leadingchar"\filename@base% - \fi% - \ifx\filename@ext\relax\else% - \svg@quotes@remove{\filename@ext}% - \svg@extension@parse{#1}% - \if@svg@quotes@found% - \edef\filename@base{\filename@base"}% - \fi% - \fi% - \svg@quotes@remove{\filename@base}% - \if@svg@quotes@found% - \edef\filename@base{"\filename@base"}% - \fi% - \edef\svg@tempa{% - \endgroup% - \def\noexpand\filename@area{\filename@area}% - \def\noexpand\filename@base{\filename@base}% - \ifx\filename@ext\relax% - \let\noexpand\filename@ext\noexpand\relax% - \else% - \def\noexpand\filename@ext{\filename@ext}% - \fi% - }% - \svg@tempa% -} -\newcommand*\svg@extension@parse[1]{% - \IfArgIsEmpty{#1}{}{% - \@expandtwoargs\Ifstr% - {\detokenize\expandafter{\filename@ext}}{\detokenize\expandafter{#1}}{}{% - \begingroup% - \edef\svg@tempa{% - \def\noexpand\svg@tempa{}% - \let\noexpand\svg@tempb\relax% - \noexpand\svg@extension@@parse% - \filename@ext.\noexpand\@nil#1\noexpand\@nil% - }% - \svg@tempa% - \edef\svg@tempa{% - \endgroup% - \def\noexpand\filename@base{\filename@base\svg@tempa}% - \ifx\svg@tempb\relax% - \let\noexpand\filename@ext\relax% - \else% - \def\noexpand\filename@ext{\svg@tempb}% - \fi% - }% - \svg@tempa% - }% - }% -} -\newcommand*\svg@extension@@parse{} -\def\svg@extension@@parse#1.#2\@nil#3\@nil{% - \edef\svg@tempa{\svg@tempa.#1}% - \IfArgIsEmpty{#2}{}{% - \Ifstr{\detokenize{#2}}{\detokenize{#3.}}{% - \edef\svg@tempb{#3}% - }{% - \svg@extension@@parse#2\@nil#3\@nil% - }% +\DefineFamilyMember[.param]{SVG} +\newcommand*\svg@local@param@use{} +\newcommand*\svg@local@param@def[1]{% + \edef\svg@local@param@use{% + \unexpanded\expandafter{\svg@local@param@use}\unexpanded{#1}% }% } -\newcommand*\svg@iffilenewer[2]{\@gobbletwo} -\ifx\pdf@filemoddate\@undefined - \ifx\filemoddate\@undefined\else - \ifx\strcmp\@undefined\else - \renewcommand*\svg@iffilenewer[2]{% - \begingroup% - \edef\svg@tempa{\filemoddate{#1}}% - \edef\svg@tempb{\filemoddate{#2}}% - \ifnum\strcmp{\svg@tempa}{\svg@tempb}>\z@\relax% - \aftergroup\@firstoftwo% - \else% - \aftergroup\@secondoftwo% - \fi% - \endgroup% - }% - \fi - \fi -\else - \ifx\pdf@strcmp\@undefined\else - \renewcommand*\svg@iffilenewer[2]{% - \begingroup% - \edef\svg@tempa{\pdf@filemoddate{#1}}% - \edef\svg@tempb{\pdf@filemoddate{#2}}% - \ifnum\pdf@strcmp{\svg@tempa}{\svg@tempb}>\z@\relax% - \aftergroup\@firstoftwo% - \else% - \aftergroup\@secondoftwo% - \fi% - \endgroup% - }% - \fi -\fi \newcommand*\svg@local@param@set[1]{% \svg@local@param@use% \FamilyOptions{SVG}{#1}% \Ifstr{\svg@ink@format}{png}{\FamilyOptions{SVG}{inkscapelatex=false}}{}% - \@svg@tempswafalse% + \@svg@tempswatrue% \ifdim\svg@param@width>\z@\relax\ifdim\svg@param@height>\z@\relax% - \@svg@tempswatrue% + \@svg@tempswafalse% \fi\fi% - \if@svg@tempswa\else% - \FamilyOptions{SVG}{distort=false}% + \if@svg@tempswa% + \FamilyExecuteOptions[.svg.sty]{SVG}{distort=false}% \fi% } -\newcommand*\svg@local@param@use{} -\newcommand*\svg@local@param@def[1]{% - \edef\svg@local@param@use{% - \unexpanded\expandafter{\svg@local@param@use}\unexpanded{#1}% - }% +\newcommand*\svg@deprecated@param{% + \@svg@tempswafalse% + \ifx\svgwidth\@undefined\else% + \edef\svg@tempa{\noexpand\FamilyOptions{SVG}{width=\svgwidth}}% + \svg@tempa% + \@svg@tempswatrue% + \fi% + \ifx\svgscale\@undefined\else% + \edef\svg@tempa{\noexpand\FamilyOptions{SVG}{scale=\svgscale}}% + \svg@tempa% + \@svg@tempswatrue% + \fi% + \if@svg@tempswa% + \PackageWarning{svg}{% + You should specify the image size with parameters\MessageBreak% + `width' and `height' or `scale' instead of using\MessageBreak% + `\string\svgscale' or `\string\svgwidth'% + }% + \let\svgwidth\@undefined% + \let\svgscale\@undefined% + \fi% } -\DefineFamilyMember[.param]{SVG} \newcommand*\svgsetup{\FamilyOptions{SVG}} \newcommand*\setsvg{\FamilyOptions{SVG}} \newcommand*\svg@input@path{} @@ -847,6 +857,7 @@ \newcommand*\svg@param@angle{0} \svg@local@param@def{% \DefineFamilyKey[.param]{SVG}{angle}{% + \FamilyKeyStateUnknownValue% \Ifisdimension{#1\p@}{% \renewcommand*\svg@param@angle{#1}% \FamilyKeyStateProcessed% @@ -921,28 +932,6 @@ \fi% \endgroup% } -\newcommand*\svg@deprecated@param{% - \@svg@tempswafalse% - \ifx\svgwidth\@undefined\else% - \edef\svg@tempa{\noexpand\FamilyOptions{SVG}{width=\svgwidth}}% - \svg@tempa% - \@svg@tempswatrue% - \fi% - \ifx\svgscale\@undefined\else% - \edef\svg@tempa{\noexpand\FamilyOptions{SVG}{scale=\svgscale}}% - \svg@tempa% - \@svg@tempswatrue% - \fi% - \if@svg@tempswa% - \PackageWarning{svg}{% - You should specify the image size with parameters\MessageBreak% - `width' and `height' or `scale' instead of using\MessageBreak% - `\string\svgscale' or `\string\svgwidth'% - }% - \let\svgwidth\@undefined% - \let\svgscale\@undefined% - \fi% -} \newif\if@svg@ink@run \newcommand*\svg@ink@run{% \ifnum\svg@ink@mode>\z@\relax% @@ -1018,9 +1007,9 @@ \edef\svg@tempb{\svg@tempb.\svg@ink@format}% \svg@quotes@remove{\svg@out@base}% \svg@shell@mkdir{\svg@out@path}% - \svg@shell@move{\svg@tempb}{\svg@out@base}% + \svg@shell@mv{\svg@tempb}{\svg@out@base}% \if@svg@ink@latex% - \svg@shell@move{\svg@tempb_tex}{\svg@out@base_tex}% + \svg@shell@mv{\svg@tempb_tex}{\svg@out@base_tex}% \fi% }{% \gdef\svg@ink@ver{\m@ne}% @@ -1044,49 +1033,29 @@ \endgroup% \fi% } +\newsavebox\svg@box \newcommand*\svg@input{\svg@@input} \newcommand*\svg@@input[2][]{% \IfArgIsEmpty{#1}{}{\svg@local@param@set{#1}}% \svg@set@input@path% + \@svg@tempswatrue% \if@svg@draft% - \@svg@ink@latexfalse% + \@svg@tempswafalse% \fi% - \def\svg@tempb##1.##2\@nil{% - \IfArgIsEmpty{##2}{% - \def\svg@tempb{##1}% - }{% - \edef\svg@tempa{\svg@tempa.##1}% - \svg@tempb##2\@nil% - }% - }% - \edef\svg@tempa{% - \def\noexpand\svg@tempa{}% - \noexpand\svg@tempb#2.\noexpand\@nil% - }% - \svg@tempa% - \svg@remove@leadingchar.\svg@tempa% - \begingroup% - \expandafter\filename@parse\expandafter{\svg@tempa}% - \edef\svg@tempa{% - \endgroup% - \ifx\filename@ext\relax% - \edef\noexpand\svg@tempa{\svg@tempa.\svg@tempb}% - \else% - \edef\noexpand\svg@tempa{{\svg@tempa}.\svg@tempb}% - \fi% - }% - \svg@tempa% - \edef\svg@tempb{#2}% - \if@svg@ink@latex% + \if@svg@ink@latex\else% + \@svg@tempswafalse% + \fi% + \edef\svg@tempa{#2}% + \if@svg@tempswa% \svg@patches{\svg@tempa}% \ifnum\value{svg@param@lastpage}=\z@\relax% - \expandafter\svg@get@lastpage\expandafter{\svg@tempb}% + \expandafter\svg@get@lastpage\expandafter{\svg@tempa}% \fi% \edef\svg@tempa{% \ifx\svg@param@pretex\relax\else% \noexpand\svg@param@pretex% \fi% - \noexpand\input{\svg@tempb_tex}% + \noexpand\input{\svg@tempa_tex}% \ifx\svg@param@apptex\relax\else% \noexpand\svg@param@apptex% \fi% @@ -1265,7 +1234,7 @@ }% \svg@tempa% \ifx\svg@tempa\@empty% - \ifwindows% + \svg@ifwindowsdetected{% \def\svg@tempb{\jobname.svg.ink.ver.aux}% \IfFileExists{\svg@tempb}{}{% \ShellEscape{call "\svg@ink@exe" -V > \svg@tempb}% @@ -1274,7 +1243,7 @@ \closein\@inputcheck% \ShellEscape{del \svg@tempb}% }% - \fi% + }{}% \fi% \def\svg@tempb Inkscape ##1.##2\@nil{% \gdef\svg@ink@ver{##1}% @@ -1290,6 +1259,87 @@ }% \fi% } +\newcommand*\svg@set@input@path[1][]{% + \begingroup% + \svg@deactivate@dq% + \ifx\svg@file@path\@empty\else% + \svg@normalize@path{\svg@file@path}% + \edef\svg@file@path{{\svg@file@path}}% + \fi% + \svg@append@input@path{\svg@file@path}{\svg@input@path}% + \svg@append@input@path{\svg@file@path}{\Ginput@path}% + \IfArgIsEmpty{#1}{}{\svg@append@input@path{\svg@file@path}{{#1}}}% + \svg@append@input@path{\svg@file@path}{\input@path}% + \edef\svg@tempa{% + \endgroup% + \ifx\svg@file@path\@empty\else% + \def\noexpand\input@path{\svg@file@path}% + \fi% + }% + \svg@tempa% +} +\newcommand*\svg@append@input@path[2]{% + \ifx#2\@undefined\else% + \edef\svg@tempb{#2}% + \expandafter\@tfor\expandafter\svg@tempa\expandafter:\expandafter=% + \svg@tempb\do{% + \ifx\svg@tempa\@empty\else% + \@svg@tempswatrue% + \svg@normalize@path{\svg@tempa}% + \expandafter\@tfor\expandafter\svg@tempb\expandafter:\expandafter=% + #1\do{% + \ifx\svg@tempa\svg@tempb% + \@svg@tempswafalse% + \@break@tfor% + \fi% + }% + \if@svg@tempswa% + \edef#1{#1{\svg@tempa}}% + \fi% + \fi% + }% + \fi% +} +\newif\if@svg@file@found +\newcommand*\svg@file@path{} +\newcommand*\svg@file@name{} +\newcommand*\svg@file@base{} +\newcommand*\svg@file@suffix{} +\newcommand*\svg@get@path[3][\svg@file@ext]{% + \begingroup% + \svg@filename@parse[{#1}]{#2}% + \IfArgIsEmpty{#1}{% + \edef\svg@tempa{\filename@area\filename@base.\filename@ext}% + }{% + \edef\svg@tempa{\filename@area\filename@base.#1}% + }% + \svg@set@input@path[{#3}]% + \@svg@tempswafalse% + \expandafter\IfFileExists\expandafter{\svg@tempa}{% + \expandafter\svg@quotes@check\expandafter{\svg@tempa}% + \if@svg@quotes@found\else% + \svg@quotes@remove{\@filef@und}% + \fi% + \@svg@tempswatrue% + \edef\@filef@und{\expandafter\trim@spaces\expandafter{\@filef@und}}% + \svg@filename@parse[{#1}]{\@filef@und}% + }{}% + \edef\svg@tempa{% + \endgroup% + \if@svg@tempswa% + \noexpand\@svg@file@foundtrue% + \def\noexpand\svg@file@path{\filename@area}% + \def\noexpand\svg@file@name{\filename@base}% + \def\noexpand\svg@file@base{\filename@area\filename@base}% + \else% + \noexpand\@svg@file@foundfalse% + \def\noexpand\svg@file@path{}% + \def\noexpand\svg@file@name{#2}% + \def\noexpand\svg@file@base{#2}% + \fi% + }% + \svg@tempa% +} \newcommand*\svg@picture@saved{} \let\svg@picture@saved\picture \newcommand*\svg@includegraphics@saved{} @@ -1343,50 +1393,18 @@ \newcommand*\svghidepreamblestart{% \PackageWarning{svg}{% The macro `\string\svghidepreamblestart' is only meant\MessageBreak% - to be used together with package `svg-extract'.\MessageBreak% + to be used together with package `svg-extract'. \MessageBreak% Nevertheless, nothing will happen% }% } \newcommand*\svghidepreambleend{% \PackageWarning{svg}{% The macro `\string\svghidepreambleend' is only meant\MessageBreak% - to be used together with package `svg-extract'.\MessageBreak% + to be used together with package `svg-extract'. \MessageBreak% Nevertheless, nothing will happen% }% } \newcommand*\svg@extract[1]{} -\ifnum\pdf@shellescape=\@ne\relax\else% - \expandafter\endinput% -\fi -\RequirePackage{ifplatform}[2017/10/13] -\ifwindows - \newcommand*\svg@shell@@mkdir[1]{if not exist "#1" mkdir "#1"} - \newcommand*\svg@shell@@mv{move} - \newcommand*\svg@shell@@rm{del} -\else - \newcommand*\svg@shell@@mkdir[1]{mkdir -p "#1"} - \newcommand*\svg@shell@@mv{mv} - \newcommand*\svg@shell@@rm{rm} -\fi -\newcommand*\svg@shell@mkdir[1]{% - \begingroup% - \svg@quotes@remove[{#1}]{\svg@tempa}% - \@svg@tempswatrue% - \Ifstr{\svg@tempa}{}{\@svg@tempswafalse}{% - \Ifstr{\svg@tempa}{./}{\@svg@tempswafalse}{% - }}% - \if@svg@tempswa% - \ShellEscape{\svg@shell@@mkdir{\svg@tempa}}% - \fi% - \endgroup% -} -\newcommand*\svg@shell@move[2]{% - \ShellEscape{\svg@shell@@mv\space"#1"\space"#2"}% -} -\newcommand*\svg@shell@rm[1]{% - \ShellEscape{\svg@shell@@rm\space"#1"}% -} -\svg@catcodecodes@restore \endinput %% %% End of file `svg.sty'. |