summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/svg/svg.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/svg/svg.sty')
-rw-r--r--Master/texmf-dist/tex/latex/svg/svg.sty434
1 files changed, 284 insertions, 150 deletions
diff --git a/Master/texmf-dist/tex/latex/svg/svg.sty b/Master/texmf-dist/tex/latex/svg/svg.sty
index 0948d5dc94b..61fc51de676 100644
--- a/Master/texmf-dist/tex/latex/svg/svg.sty
+++ b/Master/texmf-dist/tex/latex/svg/svg.sty
@@ -33,16 +33,25 @@
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{svg}[%
- 2017/11/29 v2.01\space%
+ 2018/09/08 v2.02\space%
(include SVG pictures)%
]
\RequirePackage{scrbase}[2016/06/14]
-\RequirePackage{ifxetex}[2010/09/12]
-\RequirePackage{ifluatex}[2016/05/16]
\RequirePackage{ifpdf}[2016/05/14]
+\RequirePackage{ifluatex}[2016/05/16]
+\RequirePackage{ifxetex}[2010/09/12]
\RequirePackage{pdftexcmds}[2016/05/21]
\RequirePackage{shellesc}[2016/06/07]
+\RequirePackage{trimspaces}[2009/09/17]
\RequirePackage{graphicx}[1999/02/16]
+\newcommand*\svg@tempa{}
+\newcommand*\svg@tempb{}
+\newbox\svg@box
+\newif\if@svg@tempswa
+\edef\svg@catcodecodes@restore{%
+ \catcode`\noexpand\"\the\catcode`\"\relax%
+}
+\@makeother\"%
\DefineFamily{SVG}
\DefineFamilyMember{SVG}
\newcommand*\svg@deprecated@key[3][svg]{%
@@ -53,9 +62,6 @@
}%
\FamilyOptions{SVG}{#3}%
}
-\newcommand*\svg@tempa{}
-\newcommand*\svg@tempb{}
-\newif\if@svg@tempswa
\newif\if@svg@use@xcolor
\FamilyBoolKey{SVG}{usexcolor}{@svg@use@xcolor}
\DeclareOption{noxcolor}{\FamilyOptions{SVG}{usexcolor=false}}
@@ -82,7 +88,7 @@
}
\newcommand*\svg@ink@mode{}
\DefineFamilyKey{SVG}{inkscape}[true]{%
- \lowercase{\def\svg@tempa{#1}}%
+ \lowercase{\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},%
@@ -93,7 +99,7 @@
{tex}{9},{latex}{9},{exportlatex}{9},{latexexport}{9},%
{notex}{10},{nolatex}{10},{noexportlatex}{10},{nolatexexport}{10},%
{latexnoexport}{10},{raw}{10},{plain}{10},{simple}{10}%
- }{\svg@tempa}%
+ }{\svg@tempb}%
\ifx\FamilyKeyState\FamilyKeyStateProcessed%
\ifnum\svg@tempa<\thr@@\relax%
\let\svg@ink@mode\svg@tempa%
@@ -120,16 +126,23 @@
\def\svg@tempa##1dpi##2\@nil{%
\ifstr{##2}{dpi}{\FamilyOptions{SVG}{inkscapedpi=##1}}{}%
}%
- \lowercase{\svg@tempa#1dpi\@nil}%
+ \lowercase{\expandafter\svg@tempa\svg@tempb dpi\@nil}%
\ifx\FamilyKeyState\FamilyKeyStateProcessed\else%
+ \svg@quotes@remove[{#1}]{\svg@tempb}%
\def\svg@tempa##1-##2\@nil{%
\IfArgIsEmpty{##2}{\def\svg@tempb{}}{%
- \def\svg@tempa##1####1\@nil{\def\svg@tempb{####1}}%
- \svg@tempa#1\@nil%
+ \def\svg@tempa####1-\@nil{\def\svg@tempb{-####1}}%
+ \svg@tempa##2\@nil%
}%
- \def\svg@tempa{##1}%
+ \edef\svg@tempa{\trim@spaces{##1}}%
+ }%
+ \edef\svg@tempb{%
+ \noexpand\svg@tempa\svg@tempb-\noexpand\@nil%
}%
- \svg@tempa#1-\@nil%
+ \svg@tempb%
+ \if@svg@quotes@found%
+ \edef\svg@tempa{"\svg@tempa"}%
+ \fi%
\PackageWarning{svg}{%
Setting the executable%
\ifx\svg@tempb\@empty\else%
@@ -235,14 +248,8 @@
}
\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}%
+ \lowercase{\svg@quotes@remove[{#1}]{\svg@file@ext}}%
+ \svg@remove@leadingchar.\svg@file@ext%
}
\DefineFamilyKey{SVG}{extension}{\FamilyOptions{SVG}{svgextension=#1}}
\DefineFamilyKey{SVG}{ext}{\FamilyOptions{SVG}{svgextension=#1}}
@@ -250,12 +257,13 @@
\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}{%
{svgpath}{0},{svgdir}{0},%
{svgsubpath}{1},{svgsubdir}{1},%
{basepath}{2},{basedir}{2},{jobpath}{2},{jobdir}{2},%
{basesubpath}{3},{basesubdir}{3},{jobsubpath}{3},{jobsubdir}{3}%
- }{#1}%
+ }{\svg@tempb}%
\ifx\FamilyKeyState\FamilyKeyStateProcessed%
\ifcase\svg@tempa\relax% svgpath
\renewcommand*\svg@out@path{\svg@file@path}%
@@ -267,7 +275,7 @@
\renewcommand*\svg@out@path{./svg-inkscape/}%
\fi%
\else%
- \renewcommand*\svg@out@path{#1}%
+ \edef\svg@out@path{\svg@tempb}%
\svg@normalize@path{\svg@out@path}%
\FamilyKeyStateProcessed%
\fi%
@@ -284,8 +292,10 @@
\FamilyKeyStateProcessed%
}{%
\FamilySetLengthMacro{SVG}{width}{\svg@param@width}{#1}%
- \ifdim\svg@param@width<\z@\relax%
- \FamilyKeyStateUnknownValue%
+ \ifx\FamilyKeyState\FamilyKeyStateProcessed%
+ \ifdim\svg@param@width<\z@\relax%
+ \FamilyKeyStateUnknownValue%
+ \fi%
\fi%
}%
}
@@ -297,11 +307,25 @@
\FamilyKeyStateProcessed%
}{%
\FamilySetLengthMacro{SVG}{height}{\svg@param@height}{#1}%
- \ifdim\svg@param@height<\z@\relax%
- \FamilyKeyStateUnknownValue%
+ \ifx\FamilyKeyState\FamilyKeyStateProcessed%
+ \ifdim\svg@param@height<\z@\relax%
+ \FamilyKeyStateUnknownValue%
+ \fi%
\fi%
}%
}
+\newif\if@svg@param@distort
+\FamilyBoolKey{SVG}{distort}{@svg@param@distort}
+\DefineFamilyKey{SVG}{keepaspectratio}[true]{%
+ \FamilySetBool{SVG}{keepaspectratio}{@svg@tempswa}{#1}%
+ \ifx\FamilyKeyState\FamilyKeyStateProcessed%
+ \if@svg@tempswa%
+ \FamilyOptions{SVG}{distort=false}%
+ \else
+ \FamilyOptions{SVG}{distort=true}%
+ \fi%
+ \fi%
+}
\newcommand*\svg@param@scale{1}
\DefineFamilyKey{SVG}{scale}{%
\FamilyKeyStateUnknownValue%
@@ -357,13 +381,30 @@
\newif\if@svg@draft
\FamilyBoolKey{SVG}{draft}{@svg@draft}
\AtBeginDocument{\if@svg@draft\else\ifGin@draft\@svg@drafttrue\fi\fi}
-\newcommand*\svg@quotes@remove[1]{%
+\newcommand*\svg@deactivate@dq{}
+\AfterPackage*{babel}{%
+ \renewcommand*\svg@deactivate@dq{\bbl@deactivate{"}}%
+}
+\newcommand*\svg@sanitize@dq[2]{%
\begingroup%
- \edef\svg@tempa{#1}%
+ \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%
- \noexpand\def\noexpand#1{\unexpanded\expandafter{\svg@tempa}}%
+ \def\noexpand#2{\svg@tempa}%
+ \if@svg@quotes@found%
+ \noexpand\@svg@quotes@foundtrue%
+ \else%
+ \noexpand\@svg@quotes@foundfalse%
+ \fi%
}%
\svg@tempb%
}
@@ -383,43 +424,66 @@
\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}%
- \svg@append@input@path{\svg@file@path}{{#1}}%
+ \IfArgIsEmpty{#1}{}{\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}}%
+ \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#1{\unexpanded\expandafter{#1}#2}%
+ \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%
- \edef\svg@tempa{#1}%
- \svg@quotes@check{\svg@tempa}%
- \svg@quotes@remove{\svg@tempa}%
+ \svg@quotes@remove[{#1}]{\svg@tempa}%
\ifx\svg@tempa\@empty\relax%
\def\svg@tempa{./}%
\fi%
@@ -427,9 +491,9 @@
\edef\svg@tempb{%
\endgroup%
\if@svg@quotes@found%
- \noexpand\def\noexpand#1{"\unexpanded\expandafter{\svg@tempa}"}%
+ \def\noexpand#1{"\svg@tempa"}%
\else%
- \noexpand\def\noexpand#1{\unexpanded\expandafter{\svg@tempa}}%
+ \def\noexpand#1{\svg@tempa}%
\fi%
}%
\svg@tempb%
@@ -440,7 +504,7 @@
\IfArgIsEmpty{#1}{\def\svg@tempa{}}{\def\svg@tempa{#1/}}%
}{%
\svg@normalize@@path#2/\@nil%
- \edef\svg@tempa{#1/\unexpanded\expandafter{\svg@tempa}}%
+ \edef\svg@tempa{#1/\svg@tempa}%
}%
}
\newcommand*\svg@ifvalueisrelax[1]{%
@@ -515,6 +579,8 @@
\svg@dummy@key{name}
\svg@dummy@key{extractwidth}
\svg@dummy@key{extractheight}
+\svg@dummy@key{extractdistort}
+\svg@dummy@key{extractkeepaspectratio}
\svg@dummy@key{extractscale}
\svg@dummy@key{extractpretex}
\svg@dummy@key{extractapptex}
@@ -523,8 +589,9 @@
\svg@dummy@key[true]{clear}
\svg@dummy@key[true]{exclude}
\FamilyExecuteOptions{SVG}{%
- inkscape=true,inkscapepath=basesubdir,inkscapelatex=true,%
- inkscapearea=drawing,usexcolor=true,usetransparent=true%
+ inkscape=true,inkscapepath=basesubdir,
+ inkscapelatex=true,inkscapearea=drawing,distort=false,%
+ usexcolor=true,usetransparent=true%
}
\FamilyProcessOptions{SVG}
\newif\if@svg@file@found
@@ -534,94 +601,112 @@
\newcommand*\svg@file@suffix{}
\newcommand*\svg@get@path[3][\svg@file@ext]{%
\begingroup%
- \edef\svg@tempa{#2}%
- \svg@quotes@check{\svg@tempa}%
- \svg@quotes@remove{\svg@tempa}%
- \expandafter\svg@filename@parse\expandafter{\svg@tempa}%
+ \svg@filename@parse[{#1}]{#2}%
\IfArgIsEmpty{#1}{%
\edef\svg@tempa{\filename@area\filename@base.\filename@ext}%
}{%
\edef\svg@tempa{\filename@area\filename@base.#1}%
}%
- \if@svg@quotes@found%
- \edef\svg@tempa{"\svg@tempa"}%
- \fi%
- \svg@set@input@path[#3]%
+ \svg@set@input@path[{#3}]%
\@svg@tempswafalse%
\expandafter\IfFileExists\expandafter{\svg@tempa}{%
\@svg@tempswatrue%
- \expandafter\svg@filename@parse\expandafter{\@filef@und}%
+ \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%
- \noexpand\def\noexpand\svg@file@path{\filename@area}%
- \noexpand\def\noexpand\svg@file@name{\filename@base}%
- \noexpand\def\noexpand\svg@file@base{\filename@area\filename@base}%
+ \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%
- \noexpand\def\noexpand\svg@file@path{}%
- \noexpand\def\noexpand\svg@file@name{#2}%
- \noexpand\def\noexpand\svg@file@base{#2}%
+ \def\noexpand\svg@file@path{}%
+ \def\noexpand\svg@file@name{#2}%
+ \def\noexpand\svg@file@base{#2}%
\fi%
}%
\svg@tempa%
}
-\newcommand*\svg@filename@parse[1]{%
+\newcommand*\svg@filename@parse[2][]{%
\begingroup%
- \def\svg@tempa##1{%
- \def\svg@tempb####1####2\@nil{%
- \ifstr{####1}{"}{\def\svg@tempb{####2}}{\def\svg@tempb{####1####2}}%
- }%
- \expandafter\svg@tempb##1\@nil%
- \edef##1{\svg@tempb}%
- }%
- \filename@parse{#1}%
- \ifx\filename@ext\relax\else%
- \edef\filename@base{\filename@base.\filename@ext}%
- \fi%
- \svg@quotes@check{\filename@area}%
+ \svg@sanitize@dq\svg@tempa{#2}%
+ \expandafter\filename@parse\expandafter{\svg@tempa}%
+ \svg@quotes@remove{\filename@area}%
\if@svg@quotes@found%
- \svg@quotes@remove{\filename@area}%
\edef\filename@area{"\filename@area"}%
- \svg@tempa{\filename@base}%
+ \svg@remove@leadingchar"\filename@base%
\fi%
- \svg@quotes@check{\filename@base}%
- \if@svg@quotes@found%
- \svg@quotes@remove{\filename@base}%
+ \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%
- \let\svg@tempa\filename@area%
- \expandafter\filename@parse\expandafter{\filename@base}%
- \let\filename@area\svg@tempa%
+ \svg@quotes@remove{\filename@base}%
\if@svg@quotes@found%
- \edef\filename@base{"\filename@base"}%
+ \edef\filename@base{"\filename@base"}%
\fi%
\edef\svg@tempa{%
- \noexpand\endgroup%
- \noexpand\def\noexpand\filename@area{\filename@area}%
- \noexpand\def\noexpand\filename@base{\filename@base}%
+ \endgroup%
+ \def\noexpand\filename@area{\filename@area}%
+ \def\noexpand\filename@base{\filename@base}%
\ifx\filename@ext\relax%
- \noexpand\let\noexpand\filename@ext\noexpand\relax%
+ \let\noexpand\filename@ext\noexpand\relax%
\else%
- \noexpand\def\noexpand\filename@ext{\filename@ext}%
+ \def\noexpand\filename@ext{\filename@ext}%
\fi%
}%
\svg@tempa%
}
+\newcommand*\svg@extension@parse[1]{%
+ \IfArgIsEmpty{#1}{}{%
+ \ifstr{#1}{\filename@ext}{}{%
+ \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{#2}{#3.}{%
+ \edef\svg@tempb{#3}%
+ }{%
+ \svg@extension@@parse#2\@nil#3\@nil%
+ }%
+ }%
+}
\newcommand*\svg@file@missing[3][]{%
\begingroup%
- \edef\svg@tempa{#2}%
- \expandafter\svg@filename@parse\expandafter{\svg@tempa}%
- \svg@quotes@remove{\filename@area}%
- \svg@quotes@remove{\filename@base}%
- \ifx\filename@ext\relax\else%
- \svg@quotes@remove{\filename@ext}%
- \fi%
+ \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'%
+ `\filename@area\filename@base.\filename@ext'\MessageBreak%
+ although `\svg@tempb' was found.%
}%
}{%
\edef\filename@ext{#1}%
@@ -636,7 +721,7 @@
\ifx\input@path\@undefined%
\def\svg@tempb{No additional path was given.}%
\else%
- \def\svg@tempb{Following folders have been searched:}%
+ \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}%
@@ -677,6 +762,13 @@
\svg@local@param@use%
\FamilyOptions{SVG}{#1}%
\ifstr{\svg@ink@format}{png}{\FamilyOptions{SVG}{inkscapelatex=false}}{}%
+ \@svg@tempswafalse%
+ \ifdim\svg@param@width>\z@\relax\ifdim\svg@param@height>\z@\relax%
+ \@svg@tempswatrue%
+ \fi\fi%
+ \if@svg@tempswa\else%
+ \FamilyOptions{SVG}{distort=false}%
+ \fi%
}
\newcommand*\svg@local@param@use{}
\newcommand*\svg@local@param@def[1]{%
@@ -690,9 +782,16 @@
\newcommand*\svg@input@path{}
\let\svg@input@path\input@path
\newcommand*\svgpath[1]{%
- \def\svg@input@path{#1}%
+ \def\svg@tempa##1\@nil{%
+ \ifx\svg@tempb\bgroup%
+ \def\svg@input@path{#1}%
+ \else%
+ \def\svg@input@path{{#1}}%
+ \fi%
+ }%
+ \futurelet\svg@tempb\svg@tempa#1\@nil%
}
-\newcommand*{\includesvg}[2][]{%
+\newcommand*\includesvg[2][]{%
\begingroup%
\svg@deprecated@param%
\svg@local@param@set{#1}%
@@ -707,12 +806,12 @@
\svg@ink@run%
\IfFileExists{\svg@out@base}{}{%
\@svg@file@foundfalse%
- \svg@file@missing{\svg@out@base}{}%
+ \svg@file@missing{\svg@out@base}{\svg@file@base.\svg@file@ext}%
}%
\if@svg@ink@latex%
\IfFileExists{\svg@out@base_tex}{}{%
\@svg@file@foundfalse%
- \svg@file@missing{\svg@out@base_tex}{}%
+ \svg@file@missing{\svg@out@base_tex}{\svg@file@base.\svg@file@ext}%
}%
\fi%
\if@svg@file@found%
@@ -730,8 +829,10 @@
\newcommand*\svg@param@angle{0}
\svg@local@param@def{%
\DefineFamilyKey[.param]{SVG}{angle}{%
- \renewcommand*\svg@param@angle{#1}%
- \FamilyKeyStateProcessed%
+ \ifisdimension{#1\p@}{%
+ \renewcommand*\svg@param@angle{#1}%
+ \FamilyKeyStateProcessed%
+ }{}%
}%
}
\newcommand*\svg@param@origin{c}
@@ -741,39 +842,56 @@
\FamilyKeyStateProcessed%
}%
}
-\newcommand*{\includeinkscape}[2][]{%
+\newcommand*\includeinkscape[2][]{%
\begingroup%
\svg@deprecated@param%
- \filename@parse{#2}%
+ \svg@filename@parse{#2}%
\ifx\filename@ext\relax\else%
\svg@quotes@remove{\filename@ext}%
\expandafter\lowercase\expandafter{%
\expandafter\def\expandafter\filename@ext\expandafter{\filename@ext}%
}%
- \let\svg@tempb\filename@ext%
- \def\svg@tempa##1_tex##2\@nil{\def\svg@tempb{##1}}%
- \expandafter\svg@tempa\svg@tempb_tex\@nil%
- \@for\svg@tempa:={pdf,eps,ps,png}\do{%
- \ifstr{\svg@tempb}{\svg@tempa}{%
- \edef\svg@tempa{%
- \noexpand\FamilyOptions{SVG}{inkscapeformat=\svg@tempb}%
- }%
- \svg@tempa%
- }{}%
+ \def\svg@tempb##1_tex##2\@nil{%
+ \IfArgIsEmpty{##1}{}{\def\filename@ext{##1}}%
+ \ifstr{##2}{_tex}{\@svg@tempswatrue}{\@svg@tempswafalse}%
}%
- \ifstr{\filename@ext}{\svg@ink@format_tex}{%
- \FamilyOptions{SVG}{inkscapelatex=true}%
- }{}%
+ \@svg@tempswafalse%
+ \@tfor\svg@tempa:={pdf}{eps}{ps}{png}\do{%
+ \begingroup%
+ \expandafter\svg@tempb\filename@ext_tex\@nil%
+ \svg@extension@parse{\svg@tempa}%
+ \ifx\filename@ext\relax%
+ \def\svg@tempb{\endgroup}%
+ \else%
+ \edef\svg@tempb{%
+ \endgroup%
+ \noexpand\FamilyOptions{SVG}{inkscapeformat=\svg@tempa}%
+ \if@svg@tempswa%
+ \noexpand\FamilyOptions{SVG}{inkscapelatex=true}%
+ \fi%
+ \def\noexpand\filename@base{\filename@base}%
+ \def\noexpand\filename@ext{\filename@ext}%
+ \noexpand\@svg@tempswatrue%
+ }%
+ \fi%
+ \svg@tempb%
+ \if@svg@tempswa%
+ \@break@tfor%
+ \fi%
+ }%
+ \if@svg@tempswa\else%
+ \svg@extension@parse{\svg@ink@format}%
+ \fi%
\fi%
\svg@local@param@set{#1}%
- \expandafter\svg@get@path\expandafter[\svg@ink@format]{#2}{\svg@out@path}%
+ \svg@get@path[\svg@ink@format]{\filename@area\filename@base}{\svg@out@path}%
\if@svg@file@found%
\edef\svg@out@name{\svg@file@name}%
\edef\svg@out@base{\svg@file@path\svg@file@name.\svg@ink@format}%
\if@svg@ink@latex%
\IfFileExists{\svg@out@base_tex}{}{%
\@svg@file@foundfalse%
- \svg@file@missing{\svg@out@base_tex}{}%
+ \svg@file@missing{\svg@out@base_tex}{\svg@out@base}%
}%
\fi%
\if@svg@file@found%
@@ -821,8 +939,7 @@
\ifnum\pdf@shellescape=\@ne\relax\if@svg@ink@run%
\svg@iffilenewer{\svg@out@base_tex}{\svg@out@base}{%
\@svg@ink@runfalse%
- \edef\svg@tempa{\svg@out@base}%
- \svg@quotes@remove{\svg@tempa}%
+ \svg@quotes@remove[\svg@out@base]{\svg@tempa}%
\PackageWarning{svg}{%
Since the encountered filedate of file\MessageBreak%
`\svg@tempa_tex' is newer than \MessageBreak%
@@ -851,10 +968,8 @@
\space with added options `\svg@ink@opt'%
\fi%
}%
- \edef\svg@tempa{\svg@file@base}%
- \edef\svg@tempb{\svg@out@name}%
- \svg@quotes@remove{\svg@tempa}%
- \svg@quotes@remove{\svg@tempb}%
+ \svg@quotes@remove[\svg@file@base]{\svg@tempa}%
+ \svg@quotes@remove[\svg@out@name]{\svg@tempb}%
\ShellEscape{\svg@ink@cmd{\svg@tempa}{\svg@tempb}}%
\IfFileExists{\svg@out@name.\svg@ink@format}{%
\edef\svg@tempb{\svg@tempb.\svg@ink@format}%
@@ -874,8 +989,7 @@
}%
}%
\else%
- \edef\svg@tempa{\svg@file@base}%
- \svg@quotes@remove{\svg@tempa}%
+ \svg@quotes@remove[\svg@file@base]{\svg@tempa}%
\PackageWarning{svg}{%
You didn't enable `shell escape' (or `write18')\MessageBreak%
so it wasn't possible to launch the Inkscape export\MessageBreak%
@@ -922,7 +1036,7 @@
\PackageInfo{svg}{Last page of `#1' is \the\@tempcnta}%
\fi%
\edef\svg@tempa{%
- \noexpand\endgroup%
+ \endgroup%
\noexpand\FamilyOptions{SVG}{lastpage=\the\@tempcnta}%
}%
\svg@tempa%
@@ -952,32 +1066,57 @@
\if@svg@draft%
\@svg@ink@latexfalse%
\fi%
- \edef\svg@tempa{#2}%
+ \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%
+ \edef\svg@tempa{{\svg@tempa}.\svg@tempb}%
+ \edef\svg@tempb{#2}%
\if@svg@ink@latex%
\svg@patches{\svg@tempa}%
\ifnum\value{svg@param@lastpage}=\z@\relax%
- \expandafter\svg@get@lastpage\expandafter{\svg@tempa}%
+ \expandafter\svg@get@lastpage\expandafter{\svg@tempb}%
\fi%
\edef\svg@tempa{%
\ifx\svg@param@pretex\relax\else%
\noexpand\svg@param@pretex%
\fi%
- \noexpand\input{\svg@tempa_tex}%
+ \noexpand\input{\svg@tempb_tex}%
\ifx\svg@param@apptex\relax\else%
\noexpand\svg@param@apptex%
\fi%
}%
+ \if@svg@param@distort%
+ \def\svg@tempb{\resizebox*{\svg@param@width}{\svg@param@height}}%
+ \else%
+ \let\svg@tempb\@firstofone%
+ \fi%
+ \sbox\svg@box{\svg@tempb{\svg@tempa}}%
\ifdim\dimexpr\svg@param@angle\p@\relax=\z@\relax%
- \svg@tempa%
+ \let\svg@tempb\@firstofone%
\else%
- \edef\svg@tempb{origin=\svg@param@origin}%
- \expandafter\rotatebox\expandafter[\svg@tempb]{\svg@param@angle}{%
- \svg@tempa%
+ \edef\svg@tempb{%
+ \noexpand\rotatebox[origin=\svg@param@origin]{\svg@param@angle}%
}%
\fi%
+ \svg@tempb{\usebox\svg@box}%
\else%
\svg@wrn@scale%
- \edef\svg@tempb{keepaspectratio,scale=\svg@param@scale}%
+ \edef\svg@tempb{%
+ draft\if@svg@draft\else=false\fi,%
+ scale=\svg@param@scale,%
+ keepaspectratio\if@svg@param@distort=false\fi%
+ }%
\ifdim\svg@param@height>\z@\relax%
\edef\svg@tempb{\svg@tempb,height=\svg@param@height}%
\fi%
@@ -989,11 +1128,6 @@
\svg@tempb,origin=\svg@param@origin,angle=\svg@param@angle%
}%
\fi%
- \if@svg@draft%
- \edef\svg@tempb{\svg@tempb,draft}%
- \else%
- \edef\svg@tempb{\svg@tempb,draft=false}%
- \fi%
\expandafter\includegraphics\expandafter[\svg@tempb]{\svg@tempa}%
\fi%
}
@@ -1077,8 +1211,7 @@
\fi
\newcommand*\svg@shell@mkdir[1]{%
\begingroup%
- \edef\svg@tempa{#1}%
- \svg@quotes@remove{\svg@tempa}%
+ \svg@quotes@remove[{#1}]{\svg@tempa}%
\@svg@tempswatrue%
\ifstr{\svg@tempa}{}{\@svg@tempswafalse}{%
\ifstr{\svg@tempa}{./}{\@svg@tempswafalse}{%
@@ -1094,6 +1227,7 @@
\newcommand*\svg@shell@rm[1]{%
\ShellEscape{\svg@shell@@rm\space"#1"}%
}
+\svg@catcodecodes@restore
\endinput
%%
%% End of file `svg.sty'.