From cd3505f88f11b375a6fcc7b4d112edc9db836914 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Wed, 29 Nov 2017 22:07:30 +0000 Subject: svg (29nov17) git-svn-id: svn://tug.org/texlive/trunk@45941 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/svg/svg-extract.sty | 8 +- Master/texmf-dist/tex/latex/svg/svg.sty | 149 ++++++++++++++---------- 2 files changed, 90 insertions(+), 67 deletions(-) (limited to 'Master/texmf-dist/tex/latex') diff --git a/Master/texmf-dist/tex/latex/svg/svg-extract.sty b/Master/texmf-dist/tex/latex/svg/svg-extract.sty index fb2a247af56..f7472d3a063 100644 --- a/Master/texmf-dist/tex/latex/svg/svg-extract.sty +++ b/Master/texmf-dist/tex/latex/svg/svg-extract.sty @@ -26,14 +26,14 @@ %% %% 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). +%% 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} \ProvidesPackage{svg-extract}[% - 2017/05/23 v2.00b\space% + 2017/11/29 v2.01\space% (extract independent graphics from SVG pictures)% ] \RequirePackage{svg}[2017/03/27] diff --git a/Master/texmf-dist/tex/latex/svg/svg.sty b/Master/texmf-dist/tex/latex/svg/svg.sty index 9fa4dadd0c4..0948d5dc94b 100644 --- a/Master/texmf-dist/tex/latex/svg/svg.sty +++ b/Master/texmf-dist/tex/latex/svg/svg.sty @@ -26,14 +26,14 @@ %% %% 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). +%% 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} \ProvidesPackage{svg}[% - 2017/05/23 v2.00b\space% + 2017/11/29 v2.01\space% (include SVG pictures)% ] \RequirePackage{scrbase}[2016/06/14] @@ -233,6 +233,19 @@ \fi% \FamilyKeyStateProcessed% } +\newcommand*\svg@file@ext{svg} +\DefineFamilyKey{SVG}{svgextension}{% + \def\svg@tempa##1.##2.##3\relax{% + \IfArgIsEmpty{##1}{% + \def\svg@file@ext{##2}% + }{% + \def\svg@file@ext{##1}% + }% + }% + \lowercase{\svg@tempa#1..\relax}% +} +\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} @@ -370,6 +383,38 @@ \def\svg@quotes@@check#1"#2\@nil{% \IfArgIsEmpty{#2}{\@svg@quotes@foundfalse}{\@svg@quotes@foundtrue}% } +\newcommand*\svg@set@input@path[1][]{% + \begingroup% + \ifx\svg@file@path\@empty\else% + \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}% + \svg@append@input@path{\svg@file@path}{{#1}}% + \svg@append@input@path{\svg@file@path}{\input@path}% + \def\svg@tempb{}% + \expandafter\@tfor\expandafter\svg@tempa\expandafter:\expandafter=% + \svg@file@path\do{% + \ifx\svg@tempa\@empty\else% + \svg@normalize@path{\svg@tempa}% + \edef\svg@tempb{% + \unexpanded\expandafter{\svg@tempb}{\svg@tempa}% + }% + \fi% + }% + \edef\svg@tempa{% + \endgroup% + \ifx\svg@tempb\@empty\else% + \noexpand\def\noexpand\input@path{\unexpanded\expandafter{\svg@tempb}}% + \fi% + }% + \svg@tempa% +} +\newcommand*\svg@append@input@path[2]{% + \ifx#2\@undefined\else% + \edef#1{\unexpanded\expandafter{#1}#2}% + \fi% +} \newcommand*\svg@normalize@path[1]{% \begingroup% \edef\svg@tempa{#1}% @@ -487,7 +532,7 @@ \newcommand*\svg@file@name{} \newcommand*\svg@file@base{} \newcommand*\svg@file@suffix{} -\newcommand*\svg@get@path[3][svg]{% +\newcommand*\svg@get@path[3][\svg@file@ext]{% \begingroup% \edef\svg@tempa{#2}% \svg@quotes@check{\svg@tempa}% @@ -501,27 +546,15 @@ \if@svg@quotes@found% \edef\svg@tempa{"\svg@tempa"}% \fi% - \@svg@file@foundfalse% - \let\input@path\svg@path% - \svg@get@@path{\svg@tempa}% - \if@svg@file@found\else% - \ifx\Ginput@path\@undefined\else% - \let\input@path\Ginput@path% - \svg@get@@path{\svg@tempa}% - \fi% - \fi% - \IfArgIsEmpty{#3}{}{% - \if@svg@file@found\else% - \ifx#3\@undefined\else% - \edef\svg@tempb{{#3}}% - \let\input@path\svg@tempb% - \svg@get@@path{\svg@tempa}% - \fi% - \fi% - }% + \svg@set@input@path[#3]% + \@svg@tempswafalse% + \expandafter\IfFileExists\expandafter{\svg@tempa}{% + \@svg@tempswatrue% + \expandafter\svg@filename@parse\expandafter{\@filef@und}% + }{}% \edef\svg@tempa{% \endgroup% - \if@svg@file@found% + \if@svg@tempswa% \noexpand\@svg@file@foundtrue% \noexpand\def\noexpand\svg@file@path{\filename@area}% \noexpand\def\noexpand\svg@file@name{\filename@base}% @@ -535,12 +568,6 @@ }% \svg@tempa% } -\newcommand*\svg@get@@path[1]{% - \expandafter\IfFileExists\expandafter{#1}{% - \@svg@file@foundtrue% - \expandafter\svg@filename@parse\expandafter{\@filef@und}% - }{}% -} \newcommand*\svg@filename@parse[1]{% \begingroup% \def\svg@tempa##1{% @@ -598,25 +625,29 @@ }% }{% \edef\filename@ext{#1}% + \ifstr{\filename@area}{./}{\let\filename@area\@empty}{}% \edef\svg@tempb{#3}% \ifstr{\svg@tempb}{./}{\let\svg@tempb\@empty}{}% - \ifstr{\filename@area}{./}{\let\filename@area\@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 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\MessageBreak% - any other searched path given by\MessageBreak% - \string\svgpath% - \ifx\svg@path\@undefined\space\else% - \space(\svg@path)\MessageBreak% - \fi% - or \string\graphicspath% - \ifx\Ginput@path\@undefined\else% - \space(\Ginput@path)% - \fi% - \ifx\svg@tempb\@empty\else% - \MessageBreak or even `inkscapepath' (`\svg@tempb')% - \fi.% + 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% @@ -656,28 +687,19 @@ \DefineFamilyMember[.param]{SVG} \newcommand*\svgsetup{\FamilyOptions{SVG}} \newcommand*\setsvg{\FamilyOptions{SVG}} -\newcommand*\svg@path{} -\let\svg@path\input@path +\newcommand*\svg@input@path{} +\let\svg@input@path\input@path \newcommand*\svgpath[1]{% - \def\svg@tempb{}% - \@tfor\svg@tempa:=#1\do{% - \ifx\svg@tempa\@empty\else% - \svg@normalize@path{\svg@tempa}% - \edef\svg@tempb{\svg@tempb{\svg@tempa}}% - \fi% - }% - \ifx\svg@tempb\@empty\else% - \let\svg@path\svg@tempb% - \fi% + \def\svg@input@path{#1}% } \newcommand*{\includesvg}[2][]{% \begingroup% \svg@deprecated@param% \svg@local@param@set{#1}% \if@svg@ink@latex% - \def\svg@file@suffix{_svg-tex}% + \edef\svg@file@suffix{_\svg@file@ext-tex}% \else% - \def\svg@file@suffix{_svg-raw}% + \edef\svg@file@suffix{_\svg@file@ext-raw}% \fi% \@onelevel@sanitize\svg@file@suffix% \svg@get@path{#2}{}% @@ -698,7 +720,7 @@ \svg@extract{\svg@out@base}% \fi% \else% - \svg@file@missing[svg]{\svg@file@base}{}% + \svg@file@missing[\svg@file@ext]{\svg@file@base}{}% \fi% \endgroup% } @@ -791,7 +813,7 @@ \begingroup% \@svg@ink@runtrue% \ifnum\svg@ink@mode=\tw@\relax\else% - \svg@iffilenewer{\svg@file@base.svg}{\svg@out@base}{}{% + \svg@iffilenewer{\svg@file@base.\svg@file@ext}{\svg@out@base}{}{% \@svg@ink@runfalse% }% \if@svg@ink@latex% @@ -845,7 +867,7 @@ }{% \PackageWarning{svg}{% The export with Inkscape failed for file\MessageBreak% - `\svg@tempa.svg'\MessageBreak% + `\svg@tempa.\svg@file@ext'\MessageBreak% Troubleshooting: Please check in the log file how\MessageBreak% the invocation of Inkscape took place and try to\MessageBreak% execute it yourself in the terminal% @@ -857,7 +879,7 @@ \PackageWarning{svg}{% You didn't enable `shell escape' (or `write18')\MessageBreak% so it wasn't possible to launch the Inkscape export\MessageBreak% - for `\svg@tempa.svg'% + for `\svg@tempa.\svg@file@ext'% }% \fi% \fi% @@ -869,7 +891,7 @@ \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"\space% + --file="#1.\svg@file@ext"\space% --export-\svg@ink@format="#2.\svg@ink@format"\space% } \newcommand*\svg@get@lastpage[1]{% @@ -926,6 +948,7 @@ \newcommand*\svg@input{\svg@@input} \newcommand*\svg@@input[2][]{% \IfArgIsEmpty{#1}{}{\svg@local@param@set{#1}}% + \svg@set@input@path% \if@svg@draft% \@svg@ink@latexfalse% \fi% -- cgit v1.2.3